Field.h
Go to the documentation of this file.
/* -*- C++ -*- */
/****************************************************************************
** Copyright (c) 2001-2014
**
** This file is part of the QuickFIX FIX Engine
**
** This file may be distributed under the terms of the quickfixengine.org
** license as defined by quickfixengine.org and appearing in the file
** LICENSE included in the packaging of this file.
**
** This file is provided AS IS with NO WARRANTY OF ANY KIND, INCLUDING THE
** WARRANTY OF DESIGN, MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE.
**
** See http://www.quickfixengine.org/LICENSE for licensing information.
**
** Contact ask@quickfixengine.org if any conditions of this licensing are
** not clear to you.
**
****************************************************************************/
#ifndef FIX_FIELD
#define FIX_FIELD
#ifdef _MSC_VER
#pragma warning( disable : 4786 )
#endif
#include <sstream>
#include <numeric>
#include "FieldNumbers.h"
#include "FieldConvertors.h"
#include "FieldTypes.h"
#include "Utility.h"
#if defined(__SUNPRO_CC)
#include <algorithm>
#endif
namespace FIX
{
class FieldBase
{
class field_metrics
{
public:
field_metrics( const size_t length, const int checksum )
: m_length( length )
, m_checksum( checksum )
{}
size_t getLength() const
{ return m_length; }
int getCheckSum() const
{ return m_checksum; }
bool isValid() const
{ return m_length > 0; }
private:
size_t m_length;
int m_checksum;
};
friend class Message;
FieldBase( int tag,
std::string::const_iterator valueStart,
std::string::const_iterator valueEnd,
std::string::const_iterator tagStart,
std::string::const_iterator tagEnd )
: m_tag( tag )
, m_string( valueStart, valueEnd )
, m_metrics( calculateMetrics( tagStart, tagEnd ) )
{}
public:
FieldBase( int tag, const std::string& string )
: m_tag( tag ), m_string(string), m_metrics( no_metrics() )
{}
virtual ~FieldBase() {}
FieldBase( const FieldBase& rhs )
: m_tag( rhs.getTag() )
, m_string( rhs.m_string )
, m_metrics( rhs.m_metrics )
{
}
FieldBase& operator=( const FieldBase& rhs)
{
m_tag = rhs.getTag();
m_string = rhs.m_string;
m_metrics = rhs.m_metrics;
m_data.clear();
return *this;
}
void swap( FieldBase& rhs )
{
std::swap( m_tag, rhs.m_tag );
std::swap( m_metrics, rhs.m_metrics );
m_string.swap( rhs.m_string );
m_data.swap( rhs.m_data );
}
void setTag( int tag )
{
m_tag = tag;
m_metrics = no_metrics();
m_data.clear();
}
void setField( int field )
{
setTag( field );
}
void setString( const std::string& string )
{
m_string = string;
m_metrics = no_metrics();
m_data.clear();
}
int getTag() const
{ return m_tag; }
int getField() const
{ return getTag(); }
const std::string& getString() const
{ return m_string; }
const std::string& getFixString() const
{
if( m_data.empty() )
encodeTo( m_data );
return m_data;
}
size_t getLength() const
{
calculate();
return m_metrics.getLength();
}
int getTotal() const
{
calculate();
return m_metrics.getCheckSum();
}
bool operator < ( const FieldBase& field ) const
{ return m_tag < field.m_tag; }
private:
void calculate() const
{
if( m_metrics.isValid() ) return;
m_metrics = calculateMetrics( getFixString() );
}
void encodeTo( std::string& result ) const
{
size_t tagLength = FIX::number_of_symbols_in( m_tag );
size_t totalLength = tagLength + m_string.length() + 2;
result.resize( totalLength );
char * buf = (char*)result.c_str();
FIX::integer_to_string( buf, tagLength, m_tag );
buf[tagLength] = '=';
memcpy( buf + tagLength + 1, m_string.data(), m_string.length() );
buf[totalLength - 1] = '\001';
}
static field_metrics no_metrics()
{
return field_metrics( 0, 0 );
}
static field_metrics calculateMetrics(
std::string::const_iterator const start,
std::string::const_iterator const end )
{
int checksum = 0;
for ( std::string::const_iterator str = start; str != end; ++str )
checksum += (unsigned char)( *str );
#if defined(__SUNPRO_CC)
std::ptrdiff_t d;
std::distance(start, end, d);
return field_metrics( d, checksum );
#else
return field_metrics( std::distance( start, end ), checksum );
#endif
}
static field_metrics calculateMetrics( const std::string& field )
{
return calculateMetrics( field.begin(), field.end() );
}
int m_tag;
std::string m_string;
mutable std::string m_data;
mutable field_metrics m_metrics;
};
inline std::ostream& operator <<
( std::ostream& stream, const FieldBase& field )
{
stream << field.getString();
return stream;
}
inline void swap( FieldBase& lhs, FieldBase& rhs )
{
lhs.swap( rhs );
}
class StringField : public FieldBase
{
public:
explicit StringField( int field, const std::string& data )
: FieldBase( field, data ) {}
StringField( int field )
: FieldBase( field, "" ) {}
void setValue( const std::string& value )
{ setString( value ); }
const std::string& getValue() const
{ return getString(); }
operator const std::string&() const
{ return getString(); }
bool operator<( const StringField& rhs ) const
{ return getString() < rhs.getString(); }
bool operator>( const StringField& rhs ) const
{ return getString() > rhs.getString(); }
bool operator==( const StringField& rhs ) const
{ return getString() == rhs.getString(); }
bool operator!=( const StringField& rhs ) const
{ return getString() != rhs.getString(); }
bool operator<=( const StringField& rhs ) const
{ return getString() <= rhs.getString(); }
bool operator>=( const StringField& rhs ) const
{ return getString() >= rhs.getString(); }
friend bool operator<( const StringField&, const char* );
friend bool operator<( const char*, const StringField& );
friend bool operator>( const StringField&, const char* );
friend bool operator>( const char*, const StringField& );
friend bool operator==( const StringField&, const char* );
friend bool operator==( const char*, const StringField& );
friend bool operator!=( const StringField&, const char* );
friend bool operator!=( const char*, const StringField& );
friend bool operator<=( const StringField&, const char* );
friend bool operator<=( const char*, const StringField& );
friend bool operator>=( const StringField&, const char* );
friend bool operator>=( const char*, const StringField& );
friend bool operator<( const StringField&, const std::string& );
friend bool operator<( const std::string&, const StringField& );
friend bool operator>( const StringField&, const std::string& );
friend bool operator>( const std::string&, const StringField& );
friend bool operator==( const StringField&, const std::string& );
friend bool operator==( const std::string&, const StringField& );
friend bool operator!=( const StringField&, const std::string& );
friend bool operator!=( const std::string&, const StringField& );
friend bool operator<=( const StringField&, const std::string& );
friend bool operator<=( const std::string&, const StringField& );
friend bool operator>=( const StringField&, const std::string& );
friend bool operator>=( const std::string&, const StringField& );
};
inline bool operator<( const StringField& lhs, const char* rhs )
{ return lhs.getValue() < rhs; }
inline bool operator<( const char* lhs, const StringField& rhs )
{ return lhs < rhs.getValue(); }
inline bool operator>( const StringField& lhs, const char* rhs )
{ return lhs.getValue() > rhs; }
inline bool operator>( const char* lhs, const StringField& rhs )
{ return lhs > rhs.getValue(); }
inline bool operator==( const StringField& lhs, const char* rhs )
{ return lhs.getValue() == rhs; }
inline bool operator==( const char* lhs, const StringField& rhs )
{ return lhs == rhs.getValue(); }
inline bool operator!=( const StringField& lhs, const char* rhs )
{ return lhs.getValue() != rhs; }
inline bool operator!=( const char* lhs, const StringField& rhs )
{ return lhs != rhs.getValue(); }
inline bool operator<=( const StringField& lhs, const char* rhs )
{ return lhs.getValue() <= rhs; }
inline bool operator<=( const char* lhs, const StringField& rhs )
{ return lhs <= rhs.getValue(); }
inline bool operator>=( const StringField& lhs, const char* rhs )
{ return lhs.getValue() >= rhs; }
inline bool operator>=( const char* lhs, const StringField& rhs )
{ return lhs >= rhs.getValue(); }
inline bool operator<( const StringField& lhs, const std::string& rhs )
{ return lhs.getValue() < rhs; }
inline bool operator<( const std::string& lhs, const StringField& rhs )
{ return lhs < rhs.getValue(); }
inline bool operator>( const StringField& lhs, const std::string& rhs )
{ return lhs.getValue() > rhs; }
inline bool operator>( const std::string& lhs, const StringField& rhs )
{ return lhs > rhs.getValue(); }
inline bool operator==( const StringField& lhs, const std::string& rhs )
{ return lhs.getValue() == rhs; }
inline bool operator==( const std::string& lhs, const StringField& rhs )
{ return lhs == rhs.getValue(); }
inline bool operator!=( const StringField& lhs, const std::string& rhs )
{ return lhs.getValue() != rhs; }
inline bool operator!=( const std::string& lhs, const StringField& rhs )
{ return lhs != rhs.getValue(); }
inline bool operator<=( const StringField& lhs, const std::string& rhs )
{ return lhs.getValue() <= rhs; }
inline bool operator<=( const std::string& lhs, const StringField& rhs )
{ return lhs <= rhs.getValue(); }
inline bool operator>=( const StringField& lhs, const std::string& rhs )
{ return lhs.getValue() >= rhs; }
inline bool operator>=( const std::string& lhs, const StringField& rhs )
{ return lhs >= rhs.getValue(); }
class CharField : public FieldBase
{
public:
explicit CharField( int field, char data )
: FieldBase( field, CharConvertor::convert( data ) ) {}
CharField( int field )
: FieldBase( field, "" ) {}
void setValue( char value )
{ setString( CharConvertor::convert( value ) ); }
char getValue() const throw ( IncorrectDataFormat )
{ try
{ return CharConvertor::convert( getString() ); }
catch( FieldConvertError& )
{ throw IncorrectDataFormat( getTag(), getString() ); } }
operator char() const
{ return getValue(); }
};
class DoubleField : public FieldBase
{
public:
explicit DoubleField( int field, double data, int padding = 0 )
: FieldBase( field, DoubleConvertor::convert( data, padding ) ) {}
DoubleField( int field )
: FieldBase( field, "" ) {}
void setValue( double value, int padding = 0 )
{ setString( DoubleConvertor::convert( value, padding ) ); }
double getValue() const throw ( IncorrectDataFormat )
{ try
{ return DoubleConvertor::convert( getString() ); }
catch( FieldConvertError& )
{ throw IncorrectDataFormat( getTag(), getString() ); } }
operator double() const
{ return getValue(); }
};
class IntField : public FieldBase
{
public:
explicit IntField( int field, int data )
: FieldBase( field, IntConvertor::convert( data ) ) {}
IntField( int field )
: FieldBase( field, "" ) {}
void setValue( int value )
{ setString( IntConvertor::convert( value ) ); }
int getValue() const throw ( IncorrectDataFormat )
{ try
{ return IntConvertor::convert( getString() ); }
catch( FieldConvertError& )
{ throw IncorrectDataFormat( getTag(), getString() ); } }
operator const int() const
{ return getValue(); }
};
class BoolField : public FieldBase
{
public:
explicit BoolField( int field, bool data )
: FieldBase( field, BoolConvertor::convert( data ) ) {}
BoolField( int field )
: FieldBase( field, "" ) {}
void setValue( bool value )
{ setString( BoolConvertor::convert( value ) ); }
bool getValue() const throw ( IncorrectDataFormat )
{ try
{ return BoolConvertor::convert( getString() ); }
catch( FieldConvertError& )
{ throw IncorrectDataFormat( getTag(), getString() ); } }
operator bool() const
{ return getValue(); }
};
class UtcTimeStampField : public FieldBase
{
public:
explicit UtcTimeStampField( int field, const UtcTimeStamp& data, int precision = 0 )
: FieldBase( field, UtcTimeStampConvertor::convert( data, precision ) ) {}
UtcTimeStampField( int field, int precision = 0 )
: FieldBase( field, UtcTimeStampConvertor::convert( UtcTimeStamp(), precision ) ) {}
void setValue( const UtcTimeStamp& value )
{ setString( UtcTimeStampConvertor::convert( value ) ); }
UtcTimeStamp getValue() const throw ( IncorrectDataFormat )
{ try
{ return UtcTimeStampConvertor::convert( getString() ); }
catch( FieldConvertError& )
{ throw IncorrectDataFormat( getTag(), getString() ); } }
operator UtcTimeStamp() const
{ return getValue(); }
bool operator<( const UtcTimeStampField& rhs ) const
{ return getValue() < rhs.getValue(); }
bool operator==( const UtcTimeStampField& rhs ) const
{ return getValue() == rhs.getValue(); }
bool operator!=( const UtcTimeStampField& rhs ) const
{ return getValue() != rhs.getValue(); }
};
class UtcDateField : public FieldBase
{
public:
explicit UtcDateField( int field, const UtcDate& data )
: FieldBase( field, UtcDateConvertor::convert( data ) ) {}
UtcDateField( int field )
: FieldBase( field, UtcDateConvertor::convert( UtcDate() ) ) {}
void setValue( const UtcDate& value )
{ setString( UtcDateConvertor::convert( value ) ); }
UtcDate getValue() const throw ( IncorrectDataFormat )
{ try
{ return UtcDateConvertor::convert( getString() ); }
catch( FieldConvertError& )
{ throw IncorrectDataFormat( getTag(), getString() ); } }
operator UtcDate() const
{ return getValue(); }
bool operator<( const UtcDateField& rhs ) const
{ return getValue() < rhs.getValue(); }
bool operator==( const UtcDateField& rhs ) const
{ return getValue() == rhs.getValue(); }
bool operator!=( const UtcDateField& rhs ) const
{ return getValue() != rhs.getValue(); }
};
class UtcTimeOnlyField : public FieldBase
{
public:
explicit UtcTimeOnlyField( int field, const UtcTimeOnly& data, int precision = 0 )
: FieldBase( field, UtcTimeOnlyConvertor::convert( data, precision ) ) {}
UtcTimeOnlyField( int field, int precision = 0 )
: FieldBase( field, UtcTimeOnlyConvertor::convert( UtcTimeOnly(), precision ) ) {}
void setValue( const UtcTimeOnly& value )
{ setString( UtcTimeOnlyConvertor::convert( value ) ); }
UtcTimeOnly getValue() const throw ( IncorrectDataFormat )
{ try
{ return UtcTimeOnlyConvertor::convert( getString() ); }
catch( FieldConvertError& )
{ throw IncorrectDataFormat( getTag(), getString() ); } }
operator UtcTimeOnly() const
{ return getValue(); }
bool operator<( const UtcTimeOnlyField& rhs ) const
{ return getValue() < rhs.getValue(); }
bool operator==( const UtcTimeOnlyField& rhs ) const
{ return getValue() == rhs.getValue(); }
bool operator!=( const UtcTimeOnlyField& rhs ) const
{ return getValue() != rhs.getValue(); }
};
class CheckSumField : public FieldBase
{
public:
explicit CheckSumField( int field, int data )
: FieldBase( field, CheckSumConvertor::convert( data ) ) {}
CheckSumField( int field )
: FieldBase( field, "" ) {}
void setValue( int value )
{ setString( CheckSumConvertor::convert( value ) ); }
int getValue() const throw ( IncorrectDataFormat )
{ try
{ return CheckSumConvertor::convert( getString() ); }
catch( FieldConvertError& )
{ throw IncorrectDataFormat( getTag(), getString() ); } }
operator const int() const
{ return getValue(); }
};
typedef DoubleField PriceField;
typedef DoubleField AmtField;
typedef DoubleField QtyField;
typedef StringField CurrencyField;
typedef StringField MultipleValueStringField;
typedef StringField MultipleStringValueField;
typedef StringField MultipleCharValueField;
typedef StringField ExchangeField;
typedef StringField LocalMktDateField;
typedef StringField DataField;
typedef DoubleField FloatField;
typedef DoubleField PriceOffsetField;
typedef StringField MonthField;
typedef StringField MonthYearField;
typedef StringField DayOfMonthField;
typedef UtcDateField UtcDateOnlyField;
typedef IntField LengthField;
typedef IntField NumInGroupField;
typedef IntField SeqNumField;
typedef DoubleField PercentageField;
typedef StringField CountryField;
typedef StringField TzTimeOnlyField;
typedef StringField TzTimeStampField;
}
#define DEFINE_FIELD_CLASS_NUM( NAME, TOK, TYPE, NUM ) \
class NAME : public TOK##Field { public: \
NAME() : TOK##Field(NUM) {} \
NAME(const TYPE& value) : TOK##Field(NUM, value) {} \
}
#define DEFINE_FIELD_CLASS( NAME, TOK, TYPE ) \
DEFINE_FIELD_CLASS_NUM(NAME, TOK, TYPE, FIELD::NAME)
#define DEFINE_DEPRECATED_FIELD_CLASS( NAME, TOK, TYPE ) \
DEFINE_FIELD_CLASS_NUM(NAME, TOK, TYPE, DEPRECATED_FIELD::NAME)
#define DEFINE_FIELD_TIMECLASS_NUM( NAME, TOK, TYPE, NUM ) \
class NAME : public TOK##Field { public: \
NAME() : TOK##Field(NUM, false) {} \
NAME(int precision) : TOK##Field(NUM, precision) {} \
NAME(const TYPE& value) : TOK##Field(NUM, value) {} \
NAME(const TYPE& value, int precision) : TOK##Field(NUM, value, precision) {} \
}
#define DEFINE_FIELD_TIMECLASS( NAME, TOK, TYPE ) \
DEFINE_FIELD_TIMECLASS_NUM(NAME, TOK, TYPE, FIELD::NAME)
#define DEFINE_DEPRECATED_FIELD_TIMECLASS( NAME, TOK, TYPE ) \
DEFINE_FIELD_TIMECLASS_NUM(NAME, TOK, TYPE, DEPRECATED_FIELD::NAME)
#define DEFINE_CHECKSUM( NAME ) \
DEFINE_FIELD_CLASS(NAME, CheckSum, FIX::INT)
#define DEFINE_STRING( NAME ) \
DEFINE_FIELD_CLASS(NAME, String, FIX::STRING)
#define DEFINE_CHAR( NAME ) \
DEFINE_FIELD_CLASS(NAME, Char, FIX::CHAR)
#define DEFINE_PRICE( NAME ) \
DEFINE_FIELD_CLASS(NAME, Price, FIX::PRICE)
#define DEFINE_INT( NAME ) \
DEFINE_FIELD_CLASS(NAME, Int, FIX::INT)
#define DEFINE_AMT( NAME ) \
DEFINE_FIELD_CLASS(NAME, Amt, FIX::AMT)
#define DEFINE_QTY( NAME ) \
DEFINE_FIELD_CLASS(NAME, Qty, FIX::QTY)
#define DEFINE_CURRENCY( NAME ) \
DEFINE_FIELD_CLASS(NAME, Currency, FIX::CURRENCY)
#define DEFINE_MULTIPLEVALUESTRING( NAME ) \
DEFINE_FIELD_CLASS(NAME, MultipleValueString, FIX::MULTIPLEVALUESTRING)
#define DEFINE_MULTIPLESTRINGVALUE( NAME ) \
DEFINE_FIELD_CLASS(NAME, MultipleStringValue, FIX::MULTIPLESTRINGVALUE)
#define DEFINE_MULTIPLECHARVALUE( NAME ) \
DEFINE_FIELD_CLASS(NAME, MultipleCharValue, FIX::MULTIPLECHARVALUE)
#define DEFINE_EXCHANGE( NAME ) \
DEFINE_FIELD_CLASS(NAME, Exchange, FIX::EXCHANGE)
#define DEFINE_UTCTIMESTAMP( NAME ) \
DEFINE_FIELD_TIMECLASS(NAME, UtcTimeStamp, FIX::UTCTIMESTAMP)
#define DEFINE_BOOLEAN( NAME ) \
DEFINE_FIELD_CLASS(NAME, Bool, FIX::BOOLEAN)
#define DEFINE_LOCALMKTDATE( NAME ) \
DEFINE_FIELD_CLASS(NAME, String, FIX::LOCALMKTDATE)
#define DEFINE_DATA( NAME ) \
DEFINE_FIELD_CLASS(NAME, Data, FIX::DATA)
#define DEFINE_FLOAT( NAME ) \
DEFINE_FIELD_CLASS(NAME, Float, FIX::FLOAT)
#define DEFINE_PRICEOFFSET( NAME ) \
DEFINE_FIELD_CLASS(NAME, PriceOffset, FIX::PRICEOFFSET)
#define DEFINE_MONTHYEAR( NAME ) \
DEFINE_FIELD_CLASS(NAME, MonthYear, FIX::MONTHYEAR)
#define DEFINE_DAYOFMONTH( NAME ) \
DEFINE_FIELD_CLASS(NAME, DayOfMonth, FIX::DAYOFMONTH)
#define DEFINE_UTCDATE( NAME ) \
DEFINE_FIELD_CLASS(NAME, UtcDate, FIX::UTCDATE)
#define DEFINE_UTCDATEONLY( NAME ) \
DEFINE_FIELD_CLASS(NAME, UtcDateOnly, FIX::UTCDATEONLY)
#define DEFINE_UTCTIMEONLY( NAME ) \
DEFINE_FIELD_CLASS(NAME, UtcTimeOnly, FIX::UTCTIMEONLY)
#define DEFINE_NUMINGROUP( NAME ) \
DEFINE_FIELD_CLASS(NAME, NumInGroup, FIX::NUMINGROUP)
#define DEFINE_SEQNUM( NAME ) \
DEFINE_FIELD_CLASS(NAME, SeqNum, FIX::SEQNUM)
#define DEFINE_LENGTH( NAME ) \
DEFINE_FIELD_CLASS(NAME, Length, FIX::LENGTH)
#define DEFINE_PERCENTAGE( NAME ) \
DEFINE_FIELD_CLASS(NAME, Percentage, FIX::PERCENTAGE)
#define DEFINE_COUNTRY( NAME ) \
DEFINE_FIELD_CLASS(NAME, Country, FIX::COUNTRY)
#define DEFINE_TZTIMEONLY( NAME ) \
DEFINE_FIELD_CLASS(NAME, String, FIX::TZTIMEONLY)
#define DEFINE_TZTIMESTAMP( NAME ) \
DEFINE_FIELD_CLASS(NAME, String, FIX::TZTIMESTAMP)
#define DEFINE_XMLDATA( NAME ) \
DEFINE_FIELD_CLASS(NAME, String, FIX::XMLDATA)
#define DEFINE_LANGUAGE( NAME ) \
DEFINE_FIELD_CLASS(NAME, String, FIX::LANGUAGE)
#define USER_DEFINE_STRING( NAME, NUM ) \
DEFINE_FIELD_CLASS_NUM(NAME, String, FIX::STRING, NUM)
#define USER_DEFINE_CHAR( NAME, NUM ) \
DEFINE_FIELD_CLASS_NUM(NAME, Char, FIX::CHAR, NUM)
#define USER_DEFINE_PRICE( NAME, NUM ) \
DEFINE_FIELD_CLASS_NUM(NAME, Price, FIX::PRICE, NUM)
#define USER_DEFINE_INT( NAME, NUM ) \
DEFINE_FIELD_CLASS_NUM(NAME, Int, FIX::INT, NUM)
#define USER_DEFINE_AMT( NAME, NUM ) \
DEFINE_FIELD_CLASS_NUM(NAME, Amt, FIX::AMT, NUM)
#define USER_DEFINE_QTY( NAME, NUM ) \
DEFINE_FIELD_CLASS_NUM(NAME, Qty, FIX::QTY, NUM)
#define USER_DEFINE_CURRENCY( NAME, NUM ) \
DEFINE_FIELD_CLASS_NUM(NAME, Currency, FIX::CURRENCY, NUM)
#define USER_DEFINE_MULTIPLEVALUESTRING( NAME, NUM ) \
DEFINE_FIELD_CLASS_NUM(NAME, MultipleValueString, FIX::MULTIPLEVALUESTRING, NUM)
#define USER_DEFINE_MULTIPLESTRINGVALUE( NAME, NUM ) \
DEFINE_FIELD_CLASS_NUM(NAME, MultipleStringValue, FIX::MULTIPLESTRINGVALUE, NUM)
#define USER_DEFINE_MULTIPLECHARVALUE( NAME, NUM ) \
DEFINE_FIELD_CLASS_NUM(NAME, MultipleCharValue, FIX::MULTIPLECHARVALUE, NUM)
#define USER_DEFINE_EXCHANGE( NAME, NUM ) \
DEFINE_FIELD_CLASS_NUM(NAME, Exchange, FIX::EXCHANGE, NUM)
#define USER_DEFINE_UTCTIMESTAMP( NAME, NUM ) \
DEFINE_FIELD_TIMECLASS_NUM(NAME, UtcTimeStamp, FIX::UTCTIMESTAMP, NUM)
#define USER_DEFINE_BOOLEAN( NAME, NUM ) \
DEFINE_FIELD_CLASS_NUM(NAME, Bool, FIX::BOOLEAN, NUM)
#define USER_DEFINE_LOCALMKTDATE( NAME, NUM ) \
DEFINE_FIELD_CLASS_NUM(NAME, String, FIX::STRING, NUM)
#define USER_DEFINE_DATA( NAME, NUM ) \
DEFINE_FIELD_CLASS_NUM(NAME, Data, FIX::DATA, NUM)
#define USER_DEFINE_FLOAT( NAME, NUM ) \
DEFINE_FIELD_CLASS_NUM(NAME, Float, FIX::FLOAT, NUM)
#define USER_DEFINE_PRICEOFFSET( NAME, NUM ) \
DEFINE_FIELD_CLASS_NUM(NAME, PriceOffset, FIX::PRICEOFFSET, NUM)
#define USER_DEFINE_MONTHYEAR( NAME, NUM ) \
DEFINE_FIELD_CLASS_NUM(NAME, MonthYear, FIX::MONTHYEAR, NUM)
#define USER_DEFINE_DAYOFMONTH( NAME, NUM ) \
DEFINE_FIELD_CLASS_NUM(NAME, DayOfMonth, FIX::DAYOFMONTH, NUM)
#define USER_DEFINE_UTCDATE( NAME, NUM ) \
DEFINE_FIELD_CLASS_NUM(NAME, UtcDate, FIX::UTCDATE, NUM)
#define USER_DEFINE_UTCDATEONLY( NAME, NUM ) \
DEFINE_FIELD_CLASS_NUM(NAME, UtcDateOnly, FIX::UTCDATEONLY, NUM)
#define USER_DEFINE_UTCTIMEONLY( NAME, NUM ) \
DEFINE_FIELD_CLASS_NUM(NAME, UtcTimeOnly, FIX::UTCTIMEONLY, NUM)
#define USER_DEFINE_NUMINGROUP( NAME, NUM ) \
DEFINE_FIELD_CLASS_NUM(NAME, NumInGroup, FIX::NUMINGROUP, NUM)
#define USER_DEFINE_SEQNUM( NAME, NUM ) \
DEFINE_FIELD_CLASS_NUM(NAME, SeqNum, FIX::SEQNUM, NUM)
#define USER_DEFINE_LENGTH( NAME, NUM ) \
DEFINE_FIELD_CLASS_NUM(NAME, Length, FIX::LENGTH, NUM)
#define USER_DEFINE_PERCENTAGE( NAME, NUM ) \
DEFINE_FIELD_CLASS_NUM(NAME, Percentage, FIX::PERCENTAGE, NUM)
#define USER_DEFINE_COUNTRY( NAME, NUM ) \
DEFINE_FIELD_CLASS_NUM(NAME, Country, FIX::COUNTRY, NUM)
#define USER_DEFINE_TZTIMEONLY( NAME, NUM ) \
DEFINE_FIELD_CLASS_NUM(NAME, String, FIX::TZTIMEONLY, NUM)
#define USER_DEFINE_TZTIMESTAMP( NAME, NUM ) \
DEFINE_FIELD_CLASS_NUM(NAME, String, FIX::TZTIMESTAMP, NUM)
#define USER_DEFINE_XMLDATA( NAME, NUM ) \
DEFINE_FIELD_CLASS_NUM(NAME, String, FIX::XMLDATA, NUM)
#define USER_DEFINE_LANGUAGE( NAME, NUM ) \
DEFINE_FIELD_CLASS_NUM(NAME, String, FIX::LANGUAGE, NUM)
#endif
FIX::FieldBase::m_data
std::string m_data
Definition: Field.h:271
FIX::StringField::operator!=
bool operator!=(const StringField &rhs) const
Definition: Field.h:296
FIX::MonthYearField
StringField MonthYearField
Definition: Field.h:573
FIX::ExchangeField
StringField ExchangeField
Definition: Field.h:567
FIX::UtcTimeOnlyConvertor
Converts a UtcTimeOnly to/from a string.
Definition: FieldConvertors.h:563
FIX::FieldBase::field_metrics
Class used to store field metrics like total length and checksum.
Definition: Field.h:87
FIX::DoubleField::setValue
void setValue(double value, int padding=0)
Definition: Field.h:408
FIX::MonthField
StringField MonthField
Definition: Field.h:572
FIX::TYPE::UtcDate
@ UtcDate
Definition: FieldTypes.h:948
FIX::BoolField::getValue
bool getValue() const
Definition: Field.h:450
FIX::UtcDateField::setValue
void setValue(const UtcDate &value)
Definition: Field.h:495
FIX::UtcTimeOnlyField::UtcTimeOnlyField
UtcTimeOnlyField(int field, const UtcTimeOnly &data, int precision=0)
Definition: Field.h:517
FIX::FieldBase::field_metrics::field_metrics
field_metrics(const size_t length, const int checksum)
Definition: Field.h:108
FIX::UtcTimeStamp
Date and Time represented in UTC.
Definition: FieldTypes.h:599
FIX::CharConvertor::convert
static std::string convert(char value)
Definition: FieldConvertors.h:391
FIX::number_of_symbols_in
int number_of_symbols_in(const signed_int value)
Definition: FieldConvertors.h:68
FIX::swap
void swap(FieldBase &lhs, FieldBase &rhs)
Definition: Field.h:266
FIX::UtcTimeOnlyField::setValue
void setValue(const UtcTimeOnly &value)
Definition: Field.h:522
FIX::UtcTimeOnlyField::operator<
bool operator<(const UtcTimeOnlyField &rhs) const
Definition: Field.h:532
FIX::FieldBase::operator<
bool operator<(const FieldBase &field) const
Compares fields based on their tag numbers.
Definition: Field.h:213
FIX::BoolConvertor
Converts boolean to/from a string.
Definition: FieldConvertors.h:416
FIX::FieldBase::m_string
std::string m_string
Definition: Field.h:270
FIX::UtcDateField
Field that contains a UTC date value.
Definition: Field.h:487
FIX::BoolField::BoolField
BoolField(int field, bool data)
Definition: Field.h:443
FIX::FieldBase::no_metrics
static field_metrics no_metrics()
Definition: Field.h:241
FIX::FloatField
DoubleField FloatField
Definition: Field.h:570
FIX::operator<
bool operator<(const DatabaseConnectionID &lhs, const DatabaseConnectionID &rhs)
Definition: DatabaseConnectionID.h:83
FIX::UtcTimeStampConvertor
Converts a UtcTimeStamp to/from a string.
Definition: FieldConvertors.h:449
FIX::StringField::operator>
bool operator>(const StringField &rhs) const
Definition: Field.h:292
FIX::integer_to_string
char * integer_to_string(char *buf, const size_t len, signed_int t)
Definition: FieldConvertors.h:116
FIX::QtyField
DoubleField QtyField
Definition: Field.h:562
FIX::operator>=
bool operator>=(const StringField &lhs, const char *rhs)
Definition: Field.h:349
FIX::UtcTimeOnlyField
Field that contains a UTC time value.
Definition: Field.h:514
FIX::UtcTimeStampField::setValue
void setValue(const UtcTimeStamp &value)
Definition: Field.h:468
FIX::PriceField
DoubleField PriceField
Definition: Field.h:560
swap
void swap(T &lhs, T &rhs)
Definition: pugixml.cpp:5991
FIX::UtcDateField::operator==
bool operator==(const UtcDateField &rhs) const
Definition: Field.h:507
FIX::IntField
Field that contains an integer value.
Definition: Field.h:420
FIX::UtcTimeStampField::getValue
UtcTimeStamp getValue() const
Definition: Field.h:470
FIX::UtcDateField::UtcDateField
UtcDateField(int field, const UtcDate &data)
Definition: Field.h:490
FIX::CharField::CharField
CharField(int field, char data)
Definition: Field.h:383
FIX::StringField::getValue
const std::string & getValue() const
Definition: Field.h:285
FIX::UtcDateField::operator!=
bool operator!=(const UtcDateField &rhs) const
Definition: Field.h:509
FIX::BoolField
Field that contains a boolean value.
Definition: Field.h:440
FIX::UtcTimeStampField::operator==
bool operator==(const UtcTimeStampField &rhs) const
Definition: Field.h:480
FIX::FieldBase::encodeTo
void encodeTo(std::string &result) const
Serializes string representation of the Field to input string.
Definition: Field.h:226
FIX::UtcDateConvertor::convert
static std::string convert(const UtcDate &value)
Definition: FieldConvertors.h:652
FIX::FieldBase::field_metrics::isValid
bool isValid() const
Definition: Field.h:119
FIX::operator<=
bool operator<=(const StringField &lhs, const char *rhs)
Definition: Field.h:345
FIX::FieldConvertError
Unable to convert field into its native format.
Definition: Exceptions.h:83
FIX::FieldBase::getField
int getField() const
Definition: Field.h:182
FIX::PercentageField
DoubleField PercentageField
Definition: Field.h:579
FIX::UtcTimeStampField
Field that contains a UTC time stamp value.
Definition: Field.h:460
FIX::TYPE::UtcTimeStamp
@ UtcTimeStamp
Definition: FieldTypes.h:940
FIX::StringField::setValue
void setValue(const std::string &value)
Definition: Field.h:283
FIX::FieldBase::getLength
size_t getLength() const
Get the length of the fields string representation.
Definition: Field.h:199
FIX::CharField::setValue
void setValue(char value)
Definition: Field.h:388
FIX::NumInGroupField
IntField NumInGroupField
Definition: Field.h:577
FIX::StringField
MSC doesn't support partial template specialization so we have this.
Definition: Field.h:275
FIX::UtcDateField::operator<
bool operator<(const UtcDateField &rhs) const
Definition: Field.h:505
FIX::DataField
StringField DataField
Definition: Field.h:569
FIX::FieldBase::setTag
void setTag(int tag)
Definition: Field.h:157
FIX::CountryField
StringField CountryField
Definition: Field.h:580
FIX::IntConvertor::convert
static std::string convert(signed_int value)
Definition: FieldConvertors.h:170
FIX::CharConvertor
Converts character to/from a string.
Definition: FieldConvertors.h:389
FIX::AmtField
DoubleField AmtField
Definition: Field.h:561
FIX::FieldBase::swap
void swap(FieldBase &rhs)
Definition: Field.h:149
FIX::IntField::setValue
void setValue(int value)
Definition: Field.h:428
FIX::UtcTimeOnlyField::operator!=
bool operator!=(const UtcTimeOnlyField &rhs) const
Definition: Field.h:536
FIX::LocalMktDateField
StringField LocalMktDateField
Definition: Field.h:568
FIX::FieldBase::Message
friend class Message
Definition: Field.h:111
FIX::TzTimeOnlyField
StringField TzTimeOnlyField
Definition: Field.h:581
FIX::StringField::operator==
bool operator==(const StringField &rhs) const
Definition: Field.h:294
FIX::CheckSumField::setValue
void setValue(int value)
Definition: Field.h:549
FieldConvertors.h
FIX::FieldBase::getTag
int getTag() const
Get the fields integer tag.
Definition: Field.h:178
FIX::operator==
bool operator==(const DatabaseConnectionID &lhs, const DatabaseConnectionID &rhs)
Definition: DatabaseConnectionID.h:108
FIX::FieldBase::operator=
FieldBase & operator=(const FieldBase &rhs)
Definition: Field.h:139
FIX::MultipleStringValueField
StringField MultipleStringValueField
Definition: Field.h:565
FIX::FieldBase::getTotal
int getTotal() const
Get the total value the fields characters added together.
Definition: Field.h:206
FieldNumbers.h
FIX::FieldBase::~FieldBase
virtual ~FieldBase()
Definition: Field.h:129
FIX::FieldBase::m_tag
int m_tag
Definition: Field.h:269
FIX::CheckSumField::CheckSumField
CheckSumField(int field, int data)
Definition: Field.h:544
FIX::FieldBase::field_metrics::m_length
size_t m_length
Definition: Field.h:124
FIX::TYPE::UtcTimeOnly
@ UtcTimeOnly
Definition: FieldTypes.h:950
FIX::FieldBase::setField
void setField(int field)
Definition: Field.h:165
FIX::CheckSumField
Field that contains a checksum value.
Definition: Field.h:541
FIX::UtcTimeStampField::operator<
bool operator<(const UtcTimeStampField &rhs) const
Definition: Field.h:478
FIX::MultipleCharValueField
StringField MultipleCharValueField
Definition: Field.h:566
FIX::UtcTimeStampConvertor::convert
static std::string convert(const UtcTimeStamp &value, int precision=0)
Definition: FieldConvertors.h:451
FIX::UtcDateField::getValue
UtcDate getValue() const
Definition: Field.h:497
FIX::DoubleConvertor
Converts double to/from a string.
Definition: FieldConvertors.h:256
FIX::UtcTimeStampField::operator!=
bool operator!=(const UtcTimeStampField &rhs) const
Definition: Field.h:482
FIX::StringField::operator<
bool operator<(const StringField &rhs) const
Definition: Field.h:290
FIX::FieldBase::setString
void setString(const std::string &string)
Definition: Field.h:170
FIX::UtcDateOnlyField
UtcDateField UtcDateOnlyField
Definition: Field.h:575
FIX::FieldBase::calculateMetrics
static field_metrics calculateMetrics(std::string::const_iterator const start, std::string::const_iterator const end)
Calculate metrics for any input string.
Definition: Field.h:247
FIX::LengthField
IntField LengthField
Definition: Field.h:576
FIX::BoolConvertor::convert
static std::string convert(bool value)
Definition: FieldConvertors.h:418
FIX::CheckSumConvertor::convert
static std::string convert(int value)
Definition: FieldConvertors.h:231
FIX::SeqNumField
IntField SeqNumField
Definition: Field.h:578
FIX::FieldBase::m_metrics
field_metrics m_metrics
Definition: Field.h:272
FIX
Definition: Acceptor.cpp:34
FIX::FieldBase::field_metrics::getLength
size_t getLength() const
Definition: Field.h:113
FIX::PriceOffsetField
DoubleField PriceOffsetField
Definition: Field.h:571
FIX::TzTimeStampField
StringField TzTimeStampField
Definition: Field.h:582
FIX::StringField::operator<=
bool operator<=(const StringField &rhs) const
Definition: Field.h:298
FIX::CheckSumField::getValue
int getValue() const
Definition: Field.h:551
FIX::MultipleValueStringField
StringField MultipleValueStringField
Definition: Field.h:564
FIX::CurrencyField
StringField CurrencyField
Definition: Field.h:563
FIX::operator>
bool operator>(const StringField &lhs, const char *rhs)
Definition: Field.h:333
FIX::FieldBase::calculate
void calculate() const
Definition: Field.h:218
FIX::IntConvertor
Converts integer to/from a string.
Definition: FieldConvertors.h:168
FIX::FieldBase::FieldBase
FieldBase(int tag, std::string::const_iterator valueStart, std::string::const_iterator valueEnd, std::string::const_iterator tagStart, std::string::const_iterator tagEnd)
Constructor which also calculates field metrics.
Definition: Field.h:114
FIX::IntField::IntField
IntField(int field, int data)
Definition: Field.h:423
FIX::DayOfMonthField
StringField DayOfMonthField
Definition: Field.h:574
FIX::UtcTimeOnlyField::getValue
UtcTimeOnly getValue() const
Definition: Field.h:524
FIX::CharField::getValue
char getValue() const
Definition: Field.h:390
FIX::UtcDate
Date only represented in UTC.
Definition: FieldTypes.h:817
FIX::FieldBase::field_metrics::getCheckSum
int getCheckSum() const
Definition: Field.h:116
FIX::BoolField::setValue
void setValue(bool value)
Definition: Field.h:448
FIX::FieldBase
Base representation of all Field classes.
Definition: Field.h:66
FieldTypes.h
FIX::operator!=
bool operator!=(const DatabaseConnectionID &lhs, const DatabaseConnectionID &rhs)
Definition: DatabaseConnectionID.h:116
FIX::FieldBase::field_metrics::m_checksum
int m_checksum
Definition: Field.h:125
FIX::DoubleConvertor::convert
static std::string convert(double value, int padding=0)
Definition: FieldConvertors.h:272
FIX::IncorrectDataFormat
Field has a badly formatted value.
Definition: Exceptions.h:163
FIX::DoubleField::DoubleField
DoubleField(int field, double data, int padding=0)
Definition: Field.h:403
FIX::UtcTimeOnlyField::operator==
bool operator==(const UtcTimeOnlyField &rhs) const
Definition: Field.h:534
FIX::UtcTimeOnly
Time only represented in UTC.
Definition: FieldTypes.h:701
FIX::StringField::operator>=
bool operator>=(const StringField &rhs) const
Definition: Field.h:300
FIX::IntField::getValue
int getValue() const
Definition: Field.h:430
Utility.h
FIX::DoubleField
Field that contains a double value.
Definition: Field.h:400
FIX::UtcTimeOnlyConvertor::convert
static std::string convert(const UtcTimeOnly &value, int precision=0)
Definition: FieldConvertors.h:565
FIX::DoubleField::getValue
double getValue() const
Definition: Field.h:410
FIX::FieldBase::getFixString
const std::string & getFixString() const
Get the string representation of the Field (i.e.) 55=MSFT[SOH].
Definition: Field.h:190
FIX::UtcDateConvertor
Converts a UtcDate to/from a string.
Definition: FieldConvertors.h:650
FIX::UtcTimeStampField::UtcTimeStampField
UtcTimeStampField(int field, const UtcTimeStamp &data, int precision=0)
Definition: Field.h:463
FIX::FieldBase::getString
const std::string & getString() const
Get the string representation of the fields value.
Definition: Field.h:186
FIX::StringField::StringField
StringField(int field, const std::string &data)
Definition: Field.h:278