![]() |
![]() |
|
Index
Source Files
Annotated Class List
Alphabetical Class List
Class Hierarchy
Graphical Class Hierarchy
|
||
![]() |
![]() |
#include <Field.h>
Inheritance diagram for FIX::FieldBase:

Public Member Functions | |
| FieldBase (int field, const std::string &string, bool doCalculate=true) | |
| void | setField (int field) |
| void | setString (const std::string &string) |
| int | getField () const |
| Get the fields integer tag. | |
| const std::string & | getString () const |
| Get the string representation of the fields value. | |
| const std::string & | getValue () const |
| Get the string representation of the Field (i.e.) 55=MSFT[SOH]. | |
| int | getLength () const |
| Get the length of the fields string representation. | |
| int | getTotal () const |
| Get the total value the fields characters added together. | |
| bool | operator< (const FieldBase &field) const |
| Compares fields based on thier tag numbers. | |
Private Member Functions | |
| void | calculate () const |
Private Attributes | |
| int | m_field |
| std::string | m_string |
| std::string | m_data |
| int | m_length |
| int | m_total |
| bool | m_calculated |
This base class is the lowest common denominator of all fields. It keeps all fields in its most generic string representation with its integer tag.
Definition at line 45 of file Field.h.
|
||||||||||||||||
|
Definition at line 49 of file Field.h. References m_calculated, m_field, m_length, m_string, and m_total.
00050 : m_field( field ), m_string(string), m_length( 0 ), m_total( 0 ), 00051 m_calculated( false ) 00052 {} |
|
|
Definition at line 100 of file Field.h. References m_calculated, m_field, m_length, m_string, m_total, and STRING_SPRINTF. Referenced by getLength(), getTotal(), and getValue().
00101 {
00102 if( m_calculated ) return;
00103
00104 char buf[64];
00105
00106 if( 13 + m_string.length() < sizeof(buf) )
00107 {
00108 int tagLength = STRING_SPRINTF( buf, "%d=", m_field );
00109 m_length = tagLength + m_string.length() + 1;
00110 memcpy( buf + tagLength, m_string.data(), m_string.length() );
00111 buf[m_length - 1] = '\001';
00112 m_data.assign( buf, m_length );
00113 }
00114 else
00115 {
00116 m_data = IntConvertor::convert(m_field) + "=" + m_string + "\001";
00117 m_length = m_data.length();
00118 }
00119
00120 const unsigned char* iter =
00121 reinterpret_cast<const unsigned char*>( m_data.c_str() );
00122 m_total = std::accumulate( iter, iter + m_length, 0 );
00123
00124 m_calculated = true;
00125 }
|
|
|
Get the fields integer tag.
Definition at line 67 of file Field.h. References m_field. Referenced by FIX::Message::isHeaderField(), FIX::FieldMap::isSetField(), FIX::Message::isTrailerField(), FIX::DataDictionary::iterate(), FIX::Message::setGroup(), FIX::Message::setString(), FIX::Message::setStringHeader(), and FIX::DataDictionary::shouldCheckTag().
00068 { return m_field; }
|
|
|
Get the length of the fields string representation.
Definition at line 82 of file Field.h. References calculate(), and m_length.
|
|
|
Get the string representation of the fields value.
Definition at line 71 of file Field.h. References m_string. Referenced by FIX::FieldMap::getField(), FIX::StringField::getValue(), FIX::StringField::operator const std::string(), FIX::StringField::operator!=(), FIX::StringField::operator<(), FIX::StringField::operator<=(), FIX::StringField::operator==(), FIX::StringField::operator>(), FIX::StringField::operator>=(), and FIX::Message::setString().
00072 { return m_string; }
|
|
|
Get the total value the fields characters added together.
Definition at line 89 of file Field.h. References calculate(), and m_total.
|
|
|
Get the string representation of the Field (i.e.) 55=MSFT[SOH].
Reimplemented in FIX::StringField, FIX::CharField, FIX::DoubleField, FIX::IntField, FIX::BoolField, FIX::UtcTimeStampField, FIX::UtcDateField, FIX::UtcTimeOnlyField, and FIX::CheckSumField. Definition at line 75 of file Field.h. References calculate().
|
|
|
Compares fields based on thier tag numbers.
Definition at line 96 of file Field.h. References m_field.
00097 { return m_field < field.m_field; }
|
|
|
Definition at line 54 of file Field.h. References m_calculated, and m_field.
00055 {
00056 m_field = field;
00057 m_calculated = false;
00058 }
|
|
|
Definition at line 60 of file Field.h. References m_calculated, and m_string. Referenced by FIX::StringField::setValue().
00061 {
00062 m_string = string;
00063 m_calculated = false;
00064 }
|
|
|
Definition at line 132 of file Field.h. Referenced by calculate(), FieldBase(), setField(), and setString(). |
|
|
|
|
|
Definition at line 127 of file Field.h. Referenced by calculate(), FieldBase(), getField(), operator<(), and setField(). |
|
|
Definition at line 130 of file Field.h. Referenced by calculate(), FieldBase(), and getLength(). |
|
|
Definition at line 128 of file Field.h. Referenced by calculate(), FieldBase(), getString(), and setString(). |
|
|
Definition at line 131 of file Field.h. Referenced by calculate(), FieldBase(), and getTotal(). |
1.3.6-20040222 written by Dimitri van Heesch,
© 1997-2001