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


Public Member Functions | |
| Message () | |
| Message (const std::string &string, bool validate=true) throw ( InvalidMessage ) | |
| Construct a message from a string. | |
| Message (const std::string &string, const DataDictionary &dataDictionary, bool validate=true) throw ( InvalidMessage ) | |
| Construct a message from a string using a data dictionary. | |
| Message (const Message ©) | |
| void | addGroup (FIX::Group &group) |
| void | replaceGroup (unsigned num, FIX::Group &group) |
| Group & | getGroup (unsigned num, FIX::Group &group) const throw ( FieldNotFound ) |
| void | removeGroup (unsigned num, FIX::Group &group) |
| void | removeGroup (FIX::Group &group) |
| bool | hasGroup (const FIX::Group &group) |
| bool | hasGroup (unsigned num, FIX::Group &group) |
| std::string | toString (int beginStringField=FIELD::BeginString, int bodyLengthField=FIELD::BodyLength, int checkSumField=FIELD::CheckSum) const |
| Get a string representation of the message. | |
| std::string & | toString (std::string &, int beginStringField=FIELD::BeginString, int bodyLengthField=FIELD::BodyLength, int checkSumField=FIELD::CheckSum) const |
| Get a string representation without making a copy. | |
| std::string | toXML () const |
| Get a XML representation of the message. | |
| std::string & | toXML (std::string &) const |
| Get a XML representation without making a copy. | |
| void | reverseRoute (const Header &) |
| Add header informations depending on a source message. | |
| void | setString (const std::string &string, bool validate=true, const DataDictionary *pDataDictionary=0) throw ( InvalidMessage ) |
| Set a message based on a string representation This will fill in the fields on the message by parsing out the string that is passed in. | |
| void | setGroup (const std::string &msg, const FieldBase &field, const std::string &string, std::string::size_type &pos, FieldMap &map, const DataDictionary &dataDictionary) |
| bool | setStringHeader (const std::string &string) |
| Set a messages header from a string This is an optimization that can be used to get useful information from the header of a FIX string without parsing the whole thing. | |
| const Header & | getHeader () const |
| Getter for the message header. | |
| Header & | getHeader () |
| Mutable getter for the message header. | |
| const Header & | getTrailer () const |
| Getter for the message trailer. | |
| Trailer & | getTrailer () |
| Mutable getter for the message trailer. | |
| bool | hasValidStructure (int &field) const |
| int | bodyLength (int beginStringField=FIELD::BeginString, int bodyLengthField=FIELD::BodyLength, int checkSumField=FIELD::CheckSum) const |
| int | checkSum (int checkSumField=FIELD::CheckSum) const |
| bool | isAdmin () const |
| bool | isApp () const |
| bool | isEmpty () |
| Check if map contains any fields. | |
| void | clear () |
| Clear all fields from the map. | |
| SessionID | getSessionID (const std::string &qualifier="") throw ( FieldNotFound ) |
| Returns the session ID of the intended recipient. | |
| void | setSessionID (const SessionID &sessionID) |
| Sets the session ID of the intended recipient. | |
Static Public Member Functions | |
| bool | InitializeXML (const std::string &string) |
| Set global data dictionary for encoding messages into XML. | |
| bool | isAdminMsgType (const MsgType &msgType) |
| bool | isHeaderField (int field) |
| bool | isHeaderField (const FieldBase &field, const DataDictionary *pD=0) |
| bool | isTrailerField (int field) |
| bool | isTrailerField (const FieldBase &field, const DataDictionary *pD=0) |
Protected Member Functions | |
| Message (const BeginString &beginString, const MsgType &msgType) | |
Protected Attributes | |
| FieldMap | m_header |
| FieldMap | m_trailer |
| bool | m_validStructure |
| int | m_field |
Static Protected Attributes | |
| std::auto_ptr< DataDictionary > | s_dataDictionary |
Private Types | |
| enum | field_type { header, body, trailer } |
Private Member Functions | |
| FieldBase | Message::extractField (const std::string &string, std::string::size_type &pos, const DataDictionary *pDD=0, const Group *pGroup=0) |
| void | validate () |
| std::string | toXMLFields (const FieldMap &fields, int space) const |
A message consists of three field maps. One for the header, the body, and the trailer.
Definition at line 56 of file Message.h.
|
|
Definition at line 61 of file Message.h.
|
|
|
Definition at line 36 of file Message.cpp.
00037 : m_header( message_order( message_order::header ) ), 00038 m_trailer( message_order( message_order::trailer ) ), 00039 m_validStructure( true ) {} |
|
||||||||||||
|
Construct a message from a string.
Definition at line 41 of file Message.cpp.
00043 : m_header( message_order( message_order::header ) ), 00044 m_trailer( message_order( message_order::trailer ) ), 00045 m_validStructure( true ) 00046 { 00047 setString( string, validate ); 00048 } |
|
||||||||||||||||
|
Construct a message from a string using a data dictionary.
Definition at line 50 of file Message.cpp.
00054 : m_header( message_order( message_order::header ) ), 00055 m_trailer( message_order( message_order::trailer ) ), 00056 m_validStructure( true ) 00057 { 00058 setString( string, validate, &dataDictionary ); 00059 } |
|
|
Definition at line 75 of file Message.h. References header, m_field, m_header, m_trailer, m_validStructure, and trailer.
00076 : FieldMap( copy ), 00077 m_header( message_order( message_order::header ) ), 00078 m_trailer( message_order( message_order::trailer ) ) 00079 { 00080 m_header = copy.m_header; 00081 m_trailer = copy.m_trailer; 00082 m_validStructure = copy.m_validStructure; 00083 m_field = copy.m_field; 00084 } |
|
||||||||||||
|
Definition at line 113 of file Message.h. References header, m_header, m_trailer, m_validStructure, FIX::FieldMap::setField(), and trailer.
00114 : m_header( message_order( message_order::header ) ), 00115 m_trailer( message_order( message_order::trailer ) ), 00116 m_validStructure( true ) 00117 { 00118 m_header.setField( beginString ); 00119 m_header.setField( msgType ); 00120 } |
|
|
Definition at line 89 of file Message.h. References FIX::Group::field().
00090 { FieldMap::addGroup( group.field(), group ); }
|
|
||||||||||||||||
|
Definition at line 180 of file Message.h. References FIX::FieldMap::calculateLength(), m_header, and m_trailer. Referenced by toString(), and validate().
00183 { return m_header.calculateLength(beginStringField, bodyLengthField, checkSumField)
00184 + calculateLength(beginStringField, bodyLengthField, checkSumField)
00185 + m_trailer.calculateLength(beginStringField, bodyLengthField, checkSumField);
00186 }
|
|
|
Definition at line 188 of file Message.h. References FIX::FieldMap::calculateTotal(), m_header, and m_trailer. Referenced by toString(), and validate().
00189 { return ( m_header.calculateTotal(checkSumField)
00190 + calculateTotal(checkSumField)
00191 + m_trailer.calculateTotal(checkSumField) ) % 256;
00192 }
|
|
|
Clear all fields from the map.
Reimplemented from FIX::FieldMap. Definition at line 219 of file Message.h. References FIX::FieldMap::clear(), m_header, and m_trailer. Referenced by setStringHeader().
|
|
||||||||||||
|
Definition at line 95 of file Message.h. References FIX::FieldMap::clear().
|
|
|
Mutable getter for the message header.
Definition at line 169 of file Message.h. References FIX::Header, and m_header.
00169 { return m_header; }
|
|
|
|
Returns the session ID of the intended recipient.
Definition at line 497 of file Message.cpp. References QF_STACK_POP, and QF_STACK_PUSH.
00499 { QF_STACK_PUSH(Message::getSessionID)
00500
00501 BeginString beginString;
00502 SenderCompID senderCompID;
00503 TargetCompID targetCompID;
00504
00505 getHeader().getField( beginString );
00506 getHeader().getField( senderCompID );
00507 getHeader().getField( targetCompID );
00508
00509 return SessionID( beginString, senderCompID, targetCompID, qualifier );
00510
00511 QF_STACK_POP
00512 }
|
|
|
Mutable getter for the message trailer.
Definition at line 173 of file Message.h. References m_trailer, and FIX::Trailer.
00173 { return m_trailer; }
|
|
|
Getter for the message trailer.
Definition at line 171 of file Message.h. References FIX::Header, and m_trailer. Referenced by toXML().
00171 { return m_trailer; }
|
|
||||||||||||
|
Definition at line 108 of file Message.h. References FIX::Group::field().
00109 { return FieldMap::hasGroup( num, group.field() ); }
|
|
|
Definition at line 106 of file Message.h. References FIX::Group::field().
00107 { return FieldMap::hasGroup( group.field() ); }
|
|
|
Definition at line 175 of file Message.h. References m_validStructure.
00176 { field = m_field;
00177 return m_validStructure;
00178 }
|
|
|
Set global data dictionary for encoding messages into XML.
Definition at line 61 of file Message.cpp. References QF_STACK_POP, QF_STACK_PUSH, and s_dataDictionary.
00062 { QF_STACK_PUSH(Message::InitializeXML)
00063
00064 try
00065 {
00066 std::auto_ptr<DataDictionary> p =
00067 std::auto_ptr<DataDictionary>(new DataDictionary(url));
00068 s_dataDictionary = p;
00069 return true;
00070 }
00071 catch( ConfigError& )
00072 { return false; }
00073
00074 QF_STACK_POP
00075 }
|
|
|
Definition at line 194 of file Message.h. References FIX::FieldMap::getField(), isAdminMsgType(), FIX::FieldMap::isSetField(), and m_header.
00195 {
00196 MsgType msgType;
00197 if( m_header.isSetField(msgType) )
00198 {
00199 m_header.getField( msgType );
00200 return isAdminMsgType( msgType );
00201 }
00202 return false;
00203 }
|
|
|
Definition at line 227 of file Message.h. Referenced by isAdmin(), and isApp().
00228 { if ( msgType.getValue().length() != 1 ) return false;
00229 return strchr
00230 ( "0A12345",
00231 msgType.getValue().c_str() [ 0 ] ) != 0;
00232 }
|
|
|
Definition at line 205 of file Message.h. References FIX::FieldMap::getField(), isAdminMsgType(), FIX::FieldMap::isSetField(), and m_header. Referenced by FIX::Session::next().
00206 {
00207 MsgType msgType;
00208 if( m_header.isSetField(msgType) )
00209 {
00210 m_header.getField( msgType );
00211 return !isAdminMsgType( msgType );
00212 }
00213 return false;
00214 }
|
|
|
Check if map contains any fields.
Reimplemented from FIX::FieldMap. Definition at line 216 of file Message.h. References FIX::FieldMap::isEmpty(), m_header, and m_trailer.
|
|
||||||||||||
|
Definition at line 459 of file Message.cpp. References FIX::FieldBase::getField(), FIX::DataDictionary::isHeaderField(), isHeaderField(), QF_STACK_POP, and QF_STACK_PUSH.
00461 { QF_STACK_PUSH(Message::isHeaderField)
00462
00463 if ( isHeaderField( field.getField() ) ) return true;
00464 if ( pD ) return pD->isHeaderField( field.getField() );
00465 return false;
00466
00467 QF_STACK_POP
00468 }
|
|
|
Definition at line 420 of file Message.cpp. References QF_STACK_POP, and QF_STACK_PUSH. Referenced by isHeaderField(), and setStringHeader().
00421 { QF_STACK_PUSH(Message::isHeaderField)
00422
00423 switch ( field )
00424 {
00425 case FIELD::BeginString:
00426 case FIELD::BodyLength:
00427 case FIELD::MsgType:
00428 case FIELD::SenderCompID:
00429 case FIELD::TargetCompID:
00430 case FIELD::OnBehalfOfCompID:
00431 case FIELD::DeliverToCompID:
00432 case FIELD::SecureDataLen:
00433 case FIELD::MsgSeqNum:
00434 case FIELD::SenderSubID:
00435 case FIELD::SenderLocationID:
00436 case FIELD::TargetSubID:
00437 case FIELD::TargetLocationID:
00438 case FIELD::OnBehalfOfSubID:
00439 case FIELD::OnBehalfOfLocationID:
00440 case FIELD::DeliverToSubID:
00441 case FIELD::DeliverToLocationID:
00442 case FIELD::PossDupFlag:
00443 case FIELD::PossResend:
00444 case FIELD::SendingTime:
00445 case FIELD::OrigSendingTime:
00446 case FIELD::XmlDataLen:
00447 case FIELD::XmlData:
00448 case FIELD::MessageEncoding:
00449 case FIELD::LastMsgSeqNumProcessed:
00450 case FIELD::OnBehalfOfSendingTime:
00451 return true;
00452 default:
00453 return false;
00454 };
00455
00456 QF_STACK_POP
00457 }
|
|
||||||||||||
|
Definition at line 486 of file Message.cpp. References FIX::FieldBase::getField(), FIX::DataDictionary::isTrailerField(), isTrailerField(), QF_STACK_POP, and QF_STACK_PUSH.
00488 { QF_STACK_PUSH(Message::isTrailerField)
00489
00490 if ( isTrailerField( field.getField() ) ) return true;
00491 if ( pD ) return pD->isTrailerField( field.getField() );
00492 return false;
00493
00494 QF_STACK_POP
00495 }
|
|
|
Definition at line 470 of file Message.cpp. References QF_STACK_POP, and QF_STACK_PUSH. Referenced by isTrailerField().
00471 { QF_STACK_PUSH(Message::isTrailerField)
00472
00473 switch ( field )
00474 {
00475 case FIELD::SignatureLength:
00476 case FIELD::Signature:
00477 case FIELD::CheckSum:
00478 return true;
00479 default:
00480 return false;
00481 };
00482
00483 QF_STACK_POP
00484 }
|
|
||||||||||||||||||||
|
Definition at line 250 of file Message.h. References FIX::FieldMap::getField(), FIX::FieldMap::isSetField(), Message::extractField(), QF_STACK_POP, and QF_STACK_PUSH. Referenced by Message::extractField().
00252 { QF_STACK_PUSH(Message::extractField)
00253
00254 std::string::size_type equalSign
00255 = string.find_first_of( '=', pos );
00256 if( equalSign == std::string::npos )
00257 throw InvalidMessage("Equal sign not found in field");
00258
00259 int field = atol(string.substr( pos, equalSign - pos ).c_str());
00260
00261 std::string::size_type soh =
00262 string.find_first_of( '\001', equalSign + 1 );
00263 if ( soh == std::string::npos )
00264 throw InvalidMessage("SOH not found at end of field");
00265
00266 if ( pDD && pDD->isDataField(field) )
00267 {
00268 std::string fieldLength;
00269 // Assume length field is 1 less.
00270 int lenField = field - 1;
00271 // Special case for Signature which violates above assumption.
00272 if ( field == 89 ) lenField = 93;
00273
00274 if ( pGroup && pGroup->isSetField( lenField ) )
00275 {
00276 fieldLength = pGroup->getField( lenField);
00277 soh = equalSign + 1 + atol( fieldLength.c_str() );
00278 }
00279 else if ( isSetField( lenField ) )
00280 {
00281 fieldLength = getField( lenField );
00282 soh = equalSign + 1 + atol( fieldLength.c_str() );
00283 }
00284 }
00285
00286 pos = soh + 1;
00287 return FieldBase (
00288 field,
00289 string.substr( equalSign + 1, soh - ( equalSign + 1 ) ) );
00290
00291 QF_STACK_POP
00292 }
|
|
|
Definition at line 103 of file Message.h. References FIX::Group::field().
00104 { FieldMap::removeGroup( group.field() ); }
|
|
||||||||||||
|
Definition at line 101 of file Message.h. References FIX::Group::field().
00102 { FieldMap::removeGroup( num, group.field() ); }
|
|
||||||||||||
|
Definition at line 92 of file Message.h. References FIX::Group::field().
00093 { FieldMap::replaceGroup( num, group.field(), group ); }
|
|
|
Add header informations depending on a source message. This can be used to add routing informations like OnBehalfOfCompID and DeliverToCompID to a message. Definition at line 77 of file Message.cpp. References FIX::BeginString_FIX41, FIX::FieldMap::getField(), FIX::Header, FIX::FieldMap::isSetField(), m_header, QF_STACK_POP, QF_STACK_PUSH, FIX::FieldMap::removeField(), and FIX::FieldMap::setField(). Referenced by FIX::Session::generateReject().
00078 { QF_STACK_PUSH(Message::reverseRoute)
00079
00080 // required routing tags
00081 BeginString beginString;
00082 SenderCompID senderCompID;
00083 TargetCompID targetCompID;
00084
00085 m_header.removeField( beginString.getField() );
00086 m_header.removeField( senderCompID.getField() );
00087 m_header.removeField( targetCompID.getField() );
00088
00089 if( header.isSetField( beginString ) )
00090 {
00091 header.getField( beginString );
00092 if( beginString.getValue().size() )
00093 m_header.setField( beginString );
00094
00095 OnBehalfOfLocationID onBehalfOfLocationID;
00096 DeliverToLocationID deliverToLocationID;
00097
00098 m_header.removeField( onBehalfOfLocationID.getField() );
00099 m_header.removeField( deliverToLocationID.getField() );
00100
00101 if( beginString >= BeginString_FIX41 )
00102 {
00103 if( header.isSetField( onBehalfOfLocationID ) )
00104 {
00105 header.getField( onBehalfOfLocationID );
00106 if( onBehalfOfLocationID.getValue().size() )
00107 m_header.setField( DeliverToLocationID( onBehalfOfLocationID ) );
00108 }
00109
00110 if( header.isSetField( deliverToLocationID ) )
00111 {
00112 header.getField( deliverToLocationID );
00113 if( deliverToLocationID.getValue().size() )
00114 m_header.setField( OnBehalfOfLocationID( deliverToLocationID ) );
00115 }
00116 }
00117 }
00118
00119 if( header.isSetField( senderCompID ) )
00120 {
00121 header.getField( senderCompID );
00122 if( senderCompID.getValue().size() )
00123 m_header.setField( TargetCompID( senderCompID ) );
00124 }
00125
00126 if( header.isSetField( targetCompID ) )
00127 {
00128 header.getField( targetCompID );
00129 if( targetCompID.getValue().size() )
00130 m_header.setField( SenderCompID( targetCompID ) );
00131 }
00132
00133 // optional routing tags
00134 OnBehalfOfCompID onBehalfOfCompID;
00135 OnBehalfOfSubID onBehalfOfSubID;
00136 DeliverToCompID deliverToCompID;
00137 DeliverToSubID deliverToSubID;
00138
00139 m_header.removeField( onBehalfOfCompID.getField() );
00140 m_header.removeField( onBehalfOfSubID.getField() );
00141 m_header.removeField( deliverToCompID.getField() );
00142 m_header.removeField( deliverToSubID.getField() );
00143
00144 if( header.isSetField( onBehalfOfCompID ) )
00145 {
00146 header.getField( onBehalfOfCompID );
00147 if( onBehalfOfCompID.getValue().size() )
00148 m_header.setField( DeliverToCompID( onBehalfOfCompID ) );
00149 }
00150
00151 if( header.isSetField( onBehalfOfSubID ) )
00152 {
00153 header.getField( onBehalfOfSubID );
00154 if( onBehalfOfSubID.getValue().size() )
00155 m_header.setField( DeliverToSubID( onBehalfOfSubID ) );
00156 }
00157
00158 if( header.isSetField( deliverToCompID ) )
00159 {
00160 header.getField( deliverToCompID );
00161 if( deliverToCompID.getValue().size() )
00162 m_header.setField( OnBehalfOfCompID( deliverToCompID ) );
00163 }
00164
00165 if( header.isSetField( deliverToSubID ) )
00166 {
00167 header.getField( deliverToSubID );
00168 if( deliverToSubID.getValue().size() )
00169 m_header.setField( OnBehalfOfSubID( deliverToSubID ) );
00170 }
00171
00172 QF_STACK_POP
00173 }
|
|
||||||||||||||||||||||||||||
|
Definition at line 352 of file Message.cpp. References FIX::FieldMap::addGroup(), FIX::FieldBase::getField(), FIX::DataDictionary::getGroup(), FIX::DataDictionary::getOrderedFields(), FIX::DataDictionary::isField(), QF_STACK_POP, QF_STACK_PUSH, and FIX::FieldMap::setField().
00356 { QF_STACK_PUSH(Message::setGroup)
00357
00358 int group = field.getField();
00359 int delim;
00360 const DataDictionary* pDD = 0;
00361 if ( !dataDictionary.getGroup( msg, group, delim, pDD ) ) return ;
00362 Group* pGroup = 0;
00363
00364 while ( pos < string.size() )
00365 {
00366 std::string::size_type oldPos = pos;
00367 FieldBase field = extractField( string, pos, &dataDictionary, pGroup );
00368 if ( (field.getField() == delim)
00369 || (pGroup == 0 && pDD->isField(field.getField())) )
00370 {
00371 if ( pGroup )
00372 {
00373 map.addGroup( group, *pGroup, false );
00374 delete pGroup; pGroup = 0;
00375 }
00376 pGroup = new Group( field.getField(), delim, pDD->getOrderedFields() );
00377 }
00378 else if ( !pDD->isField( field.getField() ) )
00379 {
00380 if ( pGroup )
00381 {
00382 map.addGroup( group, *pGroup, false );
00383 delete pGroup; pGroup = 0;
00384 }
00385 pos = oldPos;
00386 return ;
00387 }
00388
00389 if ( !pGroup ) return ;
00390 pGroup->setField( field, false );
00391 setGroup( msg, field, string, pos, *pGroup, *pDD );
00392 }
00393
00394 QF_STACK_POP
00395 }
|
|
|
Sets the session ID of the intended recipient.
Definition at line 514 of file Message.cpp. References FIX::SessionID::getBeginString(), getHeader(), FIX::SessionID::getSenderCompID(), FIX::SessionID::getTargetCompID(), QF_STACK_POP, QF_STACK_PUSH, and FIX::FieldMap::setField().
00515 { QF_STACK_PUSH(Message::setSessionID)
00516
00517 getHeader().setField( sessionID.getBeginString() );
00518 getHeader().setField( sessionID.getSenderCompID() );
00519 getHeader().setField( sessionID.getTargetCompID() );
00520
00521 QF_STACK_POP
00522 }
|
|
||||||||||||||||
|
Set a message based on a string representation This will fill in the fields on the message by parsing out the string that is passed in. It will return true on success and false on failure. Definition at line 279 of file Message.cpp. References FIX::FieldBase::getField(), FIX::FieldBase::getString(), QF_STACK_POP, and QF_STACK_PUSH.
00283 { QF_STACK_PUSH(Message::setString)
00284
00285 clear();
00286
00287 std::string::size_type pos = 0;
00288 int count = 0;
00289 std::string msg;
00290
00291 static FIELD::Field const headerOrder[] =
00292 {
00293 FIELD::BeginString,
00294 FIELD::BodyLength,
00295 FIELD::MsgType
00296 };
00297
00298 field_type type = header;
00299
00300 while ( pos < string.size() )
00301 {
00302 FieldBase field = extractField( string, pos, pDataDictionary );
00303 if ( count < 3 && headerOrder[ count++ ] != field.getField() )
00304 if ( doValidation ) throw InvalidMessage("Header fields out of order");
00305
00306 if ( isHeaderField( field, pDataDictionary ) )
00307 {
00308 if ( type != header )
00309 {
00310 if(m_field == 0) m_field = field.getField();
00311 m_validStructure = false;
00312 }
00313
00314 if ( field.getField() == FIELD::MsgType )
00315 msg = field.getString();
00316
00317 m_header.setField( field, false );
00318
00319 if ( pDataDictionary )
00320 setGroup( "_header_", field, string, pos, getHeader(), *pDataDictionary );
00321 }
00322 else if ( isTrailerField( field, pDataDictionary ) )
00323 {
00324 type = trailer;
00325 m_trailer.setField( field, false );
00326
00327 if ( pDataDictionary )
00328 setGroup( "_trailer_", field, string, pos, getTrailer(), *pDataDictionary );
00329 }
00330 else
00331 {
00332 if ( type == trailer )
00333 {
00334 if(m_field == 0) m_field = field.getField();
00335 m_validStructure = false;
00336 }
00337
00338 type = body;
00339 setField( field, false );
00340
00341 if ( pDataDictionary )
00342 setGroup( msg, field, string, pos, *this, *pDataDictionary );
00343 }
00344 }
00345
00346 if ( doValidation )
00347 validate();
00348
00349 QF_STACK_POP
00350 }
|
|
|
Set a messages header from a string This is an optimization that can be used to get useful information from the header of a FIX string without parsing the whole thing.
Definition at line 397 of file Message.cpp. References clear(), FIX::FieldBase::getField(), isHeaderField(), m_header, QF_STACK_POP, QF_STACK_PUSH, and FIX::FieldMap::setField(). Referenced by FIX::Acceptor::getSession(), and FIX::Session::lookupSession().
00398 { QF_STACK_PUSH(Message::setStringHeader)
00399
00400 clear();
00401
00402 std::string::size_type pos = 0;
00403 int count = 0;
00404
00405 while ( pos < string.size() )
00406 {
00407 FieldBase field = extractField( string, pos );
00408 if ( count < 3 && headerOrder[ count++ ] != field.getField() )
00409 return false;
00410
00411 if ( isHeaderField( field ) )
00412 m_header.setField( field, false );
00413 else break;
00414 }
00415 return true;
00416
00417 QF_STACK_POP
00418 }
|
|
||||||||||||||||||||
|
Get a string representation without making a copy.
Definition at line 186 of file Message.cpp. References bodyLength(), FIX::FieldMap::calculateString(), checkSum(), m_header, m_trailer, QF_STACK_POP, QF_STACK_PUSH, and FIX::FieldMap::setField().
00190 { QF_STACK_PUSH(Message::toString)
00191
00192 int length = bodyLength( beginStringField, bodyLengthField, checkSumField );
00193 m_header.setField( IntField(bodyLengthField, length) );
00194 m_trailer.setField( CheckSumField(checkSumField, checkSum(checkSumField)) );
00195
00196 m_header.calculateString( str, true );
00197 FieldMap::calculateString( str, false );
00198 m_trailer.calculateString( str, false );
00199
00200 return str;
00201
00202 QF_STACK_POP
00203 }
|
|
||||||||||||||||
|
Get a string representation of the message.
Definition at line 175 of file Message.cpp. References QF_STACK_POP, and QF_STACK_PUSH. Referenced by FIX::Session::nextQueued(), FIX::Session::nextResendRequest(), and FIX::Session::sendRaw().
00178 { QF_STACK_PUSH(Message::toString)
00179
00180 std::string str;
00181 return toString( str, beginStringField, bodyLengthField, checkSumField );
00182
00183 QF_STACK_POP
00184 }
|
|
|
Get a XML representation without making a copy.
Definition at line 214 of file Message.cpp. References getHeader(), getTrailer(), QF_STACK_POP, QF_STACK_PUSH, and toXMLFields().
00215 { QF_STACK_PUSH(Message::toXML)
00216
00217 std::stringstream stream;
00218 stream << "<message>" << std::endl
00219 << std::setw(2) << " " << "<header>" << std::endl
00220 << toXMLFields(getHeader(), 4)
00221 << std::setw(2) << " " << "</header>" << std::endl
00222 << std::setw(2) << " " << "<body>" << std::endl
00223 << toXMLFields(*this, 4)
00224 << std::setw(2) << " " << "</body>" << std::endl
00225 << std::setw(2) << " " << "<trailer>" << std::endl
00226 << toXMLFields(getTrailer(), 4)
00227 << std::setw(2) << " " << "</trailer>" << std::endl
00228 << "</message>";
00229
00230 return str = stream.str();
00231
00232 QF_STACK_POP
00233 }
|
|
|
Get a XML representation of the message.
Definition at line 205 of file Message.cpp. References QF_STACK_POP, and QF_STACK_PUSH.
00206 { QF_STACK_PUSH(Message::toXML)
00207
00208 std::string str;
00209 return toXML( str );
00210
00211 QF_STACK_POP
00212 }
|
|
||||||||||||
|
Definition at line 235 of file Message.cpp. References FIX::FieldMap::begin(), FIX::FieldMap::end(), FIX::FieldMap::g_begin(), FIX::FieldMap::g_end(), FIX::FieldMap::g_iterator, FIX::FieldMap::iterator, QF_STACK_POP, QF_STACK_PUSH, and s_dataDictionary. Referenced by toXML().
00236 { QF_STACK_PUSH(Message::toXMLFields)
00237
00238 std::stringstream stream;
00239 FieldMap::iterator i;
00240 std::string name;
00241 for(i = fields.begin(); i != fields.end(); ++i)
00242 {
00243 int field = i->first;
00244 std::string value = i->second.getString();
00245
00246 stream << std::setw(space) << " " << "<field ";
00247 if(s_dataDictionary.get() && s_dataDictionary->getFieldName(field, name))
00248 {
00249 stream << "name=\"" << name << "\" ";
00250 }
00251 stream << "number=\"" << field << "\"";
00252 if(s_dataDictionary.get()
00253 && s_dataDictionary->getValueName(field, value, name))
00254 {
00255 stream << " enum=\"" << name << "\"";
00256 }
00257 stream << ">";
00258 stream << "<![CDATA[" << value << "]]>";
00259 stream << "</field>" << std::endl;
00260 }
00261
00262 FieldMap::g_iterator j;
00263 for(j = fields.g_begin(); j != fields.g_end(); ++j)
00264 {
00265 std::vector<FieldMap*>::const_iterator k;
00266 for(k = j->second.begin(); k != j->second.end(); ++k)
00267 {
00268 stream << std::setw(space) << " " << "<group>" << std::endl
00269 << toXMLFields(*(*k), space+2)
00270 << std::setw(space) << " " << "</group>" << std::endl;
00271 }
00272 }
00273
00274 return stream.str();
00275
00276 QF_STACK_POP
00277 }
|
|
|
Definition at line 524 of file Message.cpp. References bodyLength(), checkSum(), FIX::FieldMap::getField(), m_header, m_trailer, QF_STACK_POP, and QF_STACK_PUSH.
00525 { QF_STACK_PUSH(Message::validate)
00526
00527 try
00528 {
00529 BodyLength aBodyLength;
00530 m_header.getField( aBodyLength );
00531 if ( aBodyLength != bodyLength() )
00532 {
00533 std::stringstream text;
00534 text << "Expected BodyLength=" << bodyLength()
00535 << ", Recieved BodyLength=" << (int)aBodyLength;
00536 throw InvalidMessage(text.str());
00537 }
00538
00539 CheckSum aCheckSum;
00540 m_trailer.getField( aCheckSum );
00541 if ( aCheckSum != checkSum() )
00542 {
00543 std::stringstream text;
00544 text << "Expected CheckSum=" << checkSum()
00545 << ", Recieved CheckSum=" << (int)aCheckSum;
00546 throw InvalidMessage(text.str());
00547 }
00548 }
00549 catch ( FieldNotFound& )
00550 {
00551 throw InvalidMessage("BodyLength or CheckSum missing");
00552 }
00553
00554 QF_STACK_POP
00555 }
|
|
|
Definition at line 301 of file Message.h. Referenced by Message(). |
|
|
Definition at line 298 of file Message.h. Referenced by bodyLength(), checkSum(), clear(), getHeader(), isAdmin(), isApp(), isEmpty(), Message(), reverseRoute(), setStringHeader(), toString(), and validate(). |
|
|
Definition at line 299 of file Message.h. Referenced by bodyLength(), checkSum(), clear(), getTrailer(), |