Message.cpp
Go to the documentation of this file.
1/****************************************************************************
2** Copyright (c) 2001-2014
3**
4** This file is part of the QuickFIX FIX Engine
5**
6** This file may be distributed under the terms of the quickfixengine.org
7** license as defined by quickfixengine.org and appearing in the file
8** LICENSE included in the packaging of this file.
9**
10** This file is provided AS IS with NO WARRANTY OF ANY KIND, INCLUDING THE
11** WARRANTY OF DESIGN, MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE.
12**
13** See http://www.quickfixengine.org/LICENSE for licensing information.
14**
15** Contact ask@quickfixengine.org if any conditions of this licensing are
16** not clear to you.
17**
18****************************************************************************/
19
20#ifdef _MSC_VER
21#include "stdafx.h"
22#else
23#include "config.h"
24#endif
25
26#include "Message.h"
27#include "Utility.h"
28#include "Values.h"
29#include <iomanip>
30
31namespace FIX
32{
33
34int const headerOrder[] =
35{
36 FIELD::BeginString,
37 FIELD::BodyLength,
38 FIELD::MsgType
39};
40
41SmartPtr<DataDictionary> Message::s_dataDictionary;
42
44: m_validStructure( true )
45, m_tag( 0 )
46{
47
48}
49
50Message::Message(const message_order &hdrOrder, const message_order &trlOrder, const message_order& order)
51: FieldMap(order), m_header(hdrOrder),
52 m_trailer(trlOrder), m_validStructure( true ) {}
53
54Message::Message( const std::string& string, bool validate )
55throw( InvalidMessage )
56: m_validStructure( true )
57, m_tag( 0 )
58{
59 setString( string, validate );
60}
61
62Message::Message( const std::string& string,
63 const DataDictionary& dataDictionary,
64 bool validate )
65throw( InvalidMessage )
66: m_validStructure( true )
67, m_tag( 0 )
68{
69 setString( string, validate, &dataDictionary, &dataDictionary );
70}
71
72Message::Message( const std::string& string,
73 const DataDictionary& sessionDataDictionary,
74 const DataDictionary& applicationDataDictionary,
75 bool validate )
76throw( InvalidMessage )
77: m_validStructure( true )
78, m_tag( 0 )
79{
80 setString( string, validate, &sessionDataDictionary, &applicationDataDictionary );
81}
82
84 const message_order &trlOrder,
85 const message_order& order,
86 const std::string& string,
87 const DataDictionary& dataDictionary,
88 bool validate )
89throw( InvalidMessage )
90: FieldMap(order), m_header(hdrOrder),
91 m_trailer(trlOrder), m_validStructure( true )
92{
93 setString( string, validate, &dataDictionary, &dataDictionary );
94}
95
97 const message_order &trlOrder,
98 const message_order& order,
99 const std::string& string,
100 const DataDictionary& sessionDataDictionary,
101 const DataDictionary& applicationDataDictionary,
102 bool validate )
103throw( InvalidMessage )
104: FieldMap(order), m_header(hdrOrder),
105 m_trailer(trlOrder), m_validStructure( true )
106{
107 setStringHeader( string );
108 if( isAdmin() )
109 setString( string, validate, &sessionDataDictionary, &sessionDataDictionary );
110 else
111 setString( string, validate, &sessionDataDictionary, &applicationDataDictionary );
112}
113
114Message::Message( const BeginString& beginString, const MsgType& msgType )
115: m_validStructure(true)
116, m_tag( 0 )
117{
118 m_header.setField(beginString);
119 m_header.setField(msgType);
120}
121
123: FieldMap(copy)
124, m_header(copy.m_header)
125, m_trailer(copy.m_trailer)
126, m_validStructure(copy.m_validStructure)
127, m_tag(copy.m_tag)
128#ifdef HAVE_EMX
129, m_subMsgType(copy.m_subMsgType)
130#endif
131{
132
133}
134
138
139bool Message::InitializeXML( const std::string& url )
140{
141 try
142 {
143 s_dataDictionary.reset(new DataDictionary(url));
144 return true;
145 }
146 catch( ConfigError& )
147 { return false; }
148}
149
150void Message::reverseRoute( const Header& header )
151{
152 // required routing tags
153 BeginString beginString;
154 SenderCompID senderCompID;
155 TargetCompID targetCompID;
156
157 m_header.removeField( beginString.getTag() );
158 m_header.removeField( senderCompID.getTag() );
159 m_header.removeField( targetCompID.getTag() );
160
161 if( header.getFieldIfSet( beginString ) )
162 {
163 if( beginString.getValue().size() )
164 m_header.setField( beginString );
165
166 OnBehalfOfLocationID onBehalfOfLocationID;
167 DeliverToLocationID deliverToLocationID;
168
169 m_header.removeField( onBehalfOfLocationID.getTag() );
170 m_header.removeField( deliverToLocationID.getTag() );
171
172 if( beginString >= BeginString_FIX41 )
173 {
174 if( header.getFieldIfSet( onBehalfOfLocationID ) )
175 {
176 if( onBehalfOfLocationID.getValue().size() )
177 m_header.setField( DeliverToLocationID( onBehalfOfLocationID ) );
178 }
179
180 if( header.getFieldIfSet( deliverToLocationID ) )
181 {
182 if( deliverToLocationID.getValue().size() )
183 m_header.setField( OnBehalfOfLocationID( deliverToLocationID ) );
184 }
185 }
186 }
187
188 if( header.getFieldIfSet( senderCompID ) )
189 {
190 if( senderCompID.getValue().size() )
191 m_header.setField( TargetCompID( senderCompID ) );
192 }
193
194 if( header.getFieldIfSet( targetCompID ) )
195 {
196 if( targetCompID.getValue().size() )
197 m_header.setField( SenderCompID( targetCompID ) );
198 }
199
200 // optional routing tags
201 OnBehalfOfCompID onBehalfOfCompID;
202 OnBehalfOfSubID onBehalfOfSubID;
203 DeliverToCompID deliverToCompID;
204 DeliverToSubID deliverToSubID;
205
206 m_header.removeField( onBehalfOfCompID.getTag() );
207 m_header.removeField( onBehalfOfSubID.getTag() );
208 m_header.removeField( deliverToCompID.getTag() );
209 m_header.removeField( deliverToSubID.getTag() );
210
211 if( header.getFieldIfSet( onBehalfOfCompID ) )
212 {
213 if( onBehalfOfCompID.getValue().size() )
214 m_header.setField( DeliverToCompID( onBehalfOfCompID ) );
215 }
216
217 if( header.getFieldIfSet( onBehalfOfSubID ) )
218 {
219 if( onBehalfOfSubID.getValue().size() )
220 m_header.setField( DeliverToSubID( onBehalfOfSubID ) );
221 }
222
223 if( header.getFieldIfSet( deliverToCompID ) )
224 {
225 if( deliverToCompID.getValue().size() )
226 m_header.setField( OnBehalfOfCompID( deliverToCompID ) );
227 }
228
229 if( header.getFieldIfSet( deliverToSubID ) )
230 {
231 if( deliverToSubID.getValue().size() )
232 m_header.setField( OnBehalfOfSubID( deliverToSubID ) );
233 }
234}
235
236std::string Message::toString( int beginStringField,
237 int bodyLengthField,
238 int checkSumField ) const
239{
240 std::string str;
241 toString( str, beginStringField, bodyLengthField, checkSumField );
242 return str;
243}
244
245std::string& Message::toString( std::string& str,
246 int beginStringField,
247 int bodyLengthField,
248 int checkSumField ) const
249{
250 int length = bodyLength( beginStringField, bodyLengthField, checkSumField );
251 m_header.setField( IntField(bodyLengthField, length) );
252 m_trailer.setField( CheckSumField(checkSumField, checkSum(checkSumField)) );
253
254#if defined(_MSC_VER) && _MSC_VER < 1300
255 str = "";
256#else
257 str.clear();
258#endif
259
260 /*small speculation about the space needed for FIX string*/
261 str.reserve( length + 64 );
262
266
267 return str;
268}
269
270std::string Message::toXML() const
271{
272 std::string str;
273 toXML( str );
274 return str;
275}
276
277std::string& Message::toXML( std::string& str ) const
278{
279 std::stringstream stream;
280 stream << "<message>" << std::endl
281 << std::setw(2) << " " << "<header>" << std::endl
282 << toXMLFields(getHeader(), 4)
283 << std::setw(2) << " " << "</header>" << std::endl
284 << std::setw(2) << " " << "<body>" << std::endl
285 << toXMLFields(*this, 4)
286 << std::setw(2) << " " << "</body>" << std::endl
287 << std::setw(2) << " " << "<trailer>" << std::endl
288 << toXMLFields(getTrailer(), 4)
289 << std::setw(2) << " " << "</trailer>" << std::endl
290 << "</message>";
291
292 return str = stream.str();
293}
294
295std::string Message::toXMLFields(const FieldMap& fields, int space) const
296{
297 std::stringstream stream;
299 std::string name;
300 for(i = fields.begin(); i != fields.end(); ++i)
301 {
302 int field = i->getTag();
303 std::string value = i->getString();
304
305 stream << std::setw(space) << " " << "<field ";
306 if(s_dataDictionary.get() && s_dataDictionary->getFieldName(field, name))
307 {
308 stream << "name=\"" << name << "\" ";
309 }
310 stream << "number=\"" << field << "\"";
311 if(s_dataDictionary.get()
312 && s_dataDictionary->getValueName(field, value, name))
313 {
314 stream << " enum=\"" << name << "\"";
315 }
316 stream << ">";
317 stream << "<![CDATA[" << value << "]]>";
318 stream << "</field>" << std::endl;
319 }
320
322 for(j = fields.g_begin(); j != fields.g_end(); ++j)
323 {
324 std::vector<FieldMap*>::const_iterator k;
325 for(k = j->second.begin(); k != j->second.end(); ++k)
326 {
327 stream << std::setw(space) << " " << "<group>" << std::endl
328 << toXMLFields(*(*k), space+2)
329 << std::setw(space) << " " << "</group>" << std::endl;
330 }
331 }
332
333 return stream.str();
334}
335
336void Message::setString( const std::string& string,
337 bool doValidation,
338 const DataDictionary* pSessionDataDictionary,
339 const DataDictionary* pApplicationDataDictionary )
340throw( InvalidMessage )
341{
342 clear();
343
344 std::string::size_type pos = 0;
345 int count = 0;
346
347 FIX::MsgType msg;
348
349 field_type type = header;
350
351 while ( pos < string.size() )
352 {
353 FieldBase field = extractField( string, pos, pSessionDataDictionary, pApplicationDataDictionary );
354 if ( count < 3 && headerOrder[ count++ ] != field.getTag() )
355 if ( doValidation ) throw InvalidMessage("Header fields out of order");
356
357 if ( isHeaderField( field, pSessionDataDictionary ) )
358 {
359 if ( type != header )
360 {
361 if(m_tag == 0) m_tag = field.getTag();
362 m_validStructure = false;
363 }
364
365 if ( field.getTag() == FIELD::MsgType )
366 {
367 msg.setString( field.getString() );
368 if ( isAdminMsgType( msg ) )
369 {
370 pApplicationDataDictionary = pSessionDataDictionary;
371#ifdef HAVE_EMX
372 m_subMsgType.assign(msg);
373 }
374 else
375 {
376 std::string::size_type equalSign = string.find("\0019426=", pos);
377 if (equalSign == std::string::npos)
378 throw InvalidMessage("EMX message type (9426) not found");
379
380 equalSign += 6;
381 std::string::size_type soh = string.find_first_of('\001', equalSign);
382 if (soh == std::string::npos)
383 throw InvalidMessage("EMX message type (9426) soh char not found");
384 m_subMsgType.assign(string.substr(equalSign, soh - equalSign ));
385#endif
386 }
387 }
388
389 m_header.appendField( field );
390
391 if ( pSessionDataDictionary )
392 setGroup( "_header_", field, string, pos, getHeader(), *pSessionDataDictionary );
393 }
394 else if ( isTrailerField( field, pSessionDataDictionary ) )
395 {
396 type = trailer;
397 m_trailer.appendField( field );
398
399 if ( pSessionDataDictionary )
400 setGroup( "_trailer_", field, string, pos, getTrailer(), *pSessionDataDictionary );
401 }
402 else
403 {
404 if ( type == trailer )
405 {
406 if(m_tag == 0) m_tag = field.getTag();
407 m_validStructure = false;
408 }
409
410 type = body;
411 appendField( field );
412
413 if ( pApplicationDataDictionary )
414#ifdef HAVE_EMX
415 setGroup(m_subMsgType, field, string, pos, *this, *pApplicationDataDictionary);
416#else
417 setGroup( msg, field, string, pos, *this, *pApplicationDataDictionary );
418#endif
419 }
420 }
421
422 // sort fields
423 m_header.sortFields();
424 sortFields();
425 m_trailer.sortFields();
426
427 if ( doValidation )
428 validate();
429}
430
431void Message::setGroup( const std::string& msg, const FieldBase& field,
432 const std::string& string,
433 std::string::size_type& pos, FieldMap& map,
434 const DataDictionary& dataDictionary )
435{
436 int group = field.getTag();
437 int delim;
438 const DataDictionary* pDD = 0;
439 if ( !dataDictionary.getGroup( msg, group, delim, pDD ) ) return ;
440 SmartPtr<Group> pGroup;
441
442 while ( pos < string.size() )
443 {
444 std::string::size_type oldPos = pos;
445 FieldBase field = extractField( string, pos, &dataDictionary, &dataDictionary, pGroup.get() );
446
447 // Start a new group because...
448 if (// found delimiter
449 (field.getTag() == delim) ||
450 // no delimiter, but field belongs to group OR field already processed
451 (pDD->isField( field.getTag() ) && (pGroup.get() == 0 || pGroup->isSetField( field.getTag() )) ))
452 {
453 if ( pGroup.get() )
454 {
455 map.addGroupPtr( group, pGroup.release(), false );
456 }
457 pGroup.reset( new Group( field.getTag(), delim, pDD->getOrderedFields() ) );
458 }
459 else if ( !pDD->isField( field.getTag() ) )
460 {
461 if ( pGroup.get() )
462 {
463 map.addGroupPtr( group, pGroup.release(), false );
464 }
465 pos = oldPos;
466 return ;
467 }
468
469 if ( !pGroup.get() ) return ;
470 pGroup->addField( field );
471 setGroup( msg, field, string, pos, *pGroup, *pDD );
472 }
473}
474
475bool Message::setStringHeader( const std::string& string )
476{
477 clear();
478
479 std::string::size_type pos = 0;
480 int count = 0;
481
482 while ( pos < string.size() )
483 {
484 FieldBase field = extractField( string, pos );
485 if ( count < 3 && headerOrder[ count++ ] != field.getTag() )
486 return false;
487
488 if ( isHeaderField( field ) )
489 m_header.appendField( field );
490 else break;
491 }
492
494 return true;
495}
496
497bool Message::isHeaderField( int field )
498{
499 switch ( field )
500 {
501 case FIELD::BeginString:
502 case FIELD::BodyLength:
503 case FIELD::MsgType:
504 case FIELD::SenderCompID:
505 case FIELD::TargetCompID:
506 case FIELD::OnBehalfOfCompID:
507 case FIELD::DeliverToCompID:
508 case FIELD::SecureDataLen:
509 case FIELD::MsgSeqNum:
510 case FIELD::SenderSubID:
511 case FIELD::SenderLocationID:
512 case FIELD::TargetSubID:
513 case FIELD::TargetLocationID:
514 case FIELD::OnBehalfOfSubID:
515 case FIELD::OnBehalfOfLocationID:
516 case FIELD::DeliverToSubID:
517 case FIELD::DeliverToLocationID:
518 case FIELD::PossDupFlag:
519 case FIELD::PossResend:
520 case FIELD::SendingTime:
521 case FIELD::OrigSendingTime:
522 case FIELD::XmlDataLen:
523 case FIELD::XmlData:
524 case FIELD::MessageEncoding:
525 case FIELD::LastMsgSeqNumProcessed:
526 case FIELD::OnBehalfOfSendingTime:
527 case FIELD::ApplVerID:
528 case FIELD::CstmApplVerID:
529 case FIELD::NoHops:
530 return true;
531 default:
532 return false;
533 };
534}
535
537 const DataDictionary* pD )
538{
539 return isHeaderField( field.getTag(), pD );
540}
541
542bool Message::isHeaderField( int field,
543 const DataDictionary * pD )
544{
545 if ( isHeaderField( field ) ) return true;
546 if ( pD ) return pD->isHeaderField( field );
547 return false;
548}
549
550bool Message::isTrailerField( int field )
551{
552 switch ( field )
553 {
554 case FIELD::SignatureLength:
555 case FIELD::Signature:
556 case FIELD::CheckSum:
557 return true;
558 default:
559 return false;
560 };
561}
562
564 const DataDictionary* pD )
565{
566 return isTrailerField( field.getTag(), pD );
567}
568
569bool Message::isTrailerField( int field, const DataDictionary * pD )
570{
571 if ( isTrailerField( field ) ) return true;
572 if ( pD ) return pD->isTrailerField( field );
573 return false;
574}
575
576SessionID Message::getSessionID( const std::string& qualifier ) const
577throw( FieldNotFound )
578{
579 BeginString beginString;
580 SenderCompID senderCompID;
581 TargetCompID targetCompID;
582
583 getHeader().getField( beginString );
584 getHeader().getField( senderCompID );
585 getHeader().getField( targetCompID );
586
587 return SessionID( beginString, senderCompID, targetCompID, qualifier );
588}
589
590void Message::setSessionID( const SessionID& sessionID )
591{
592 getHeader().setField( sessionID.getBeginString() );
593 getHeader().setField( sessionID.getSenderCompID() );
594 getHeader().setField( sessionID.getTargetCompID() );
595}
596
598{
599 try
600 {
601 const BodyLength& aBodyLength = FIELD_GET_REF( m_header, BodyLength );
602
603 const int expectedLength = (int)aBodyLength;
604 const int actualLength = bodyLength();
605
606 if ( expectedLength != actualLength )
607 {
608 std::stringstream text;
609 text << "Expected BodyLength=" << actualLength
610 << ", Received BodyLength=" << expectedLength;
611 throw InvalidMessage(text.str());
612 }
613
614 const CheckSum& aCheckSum = FIELD_GET_REF( m_trailer, CheckSum );
615
616 const int expectedChecksum = (int)aCheckSum;
617 const int actualChecksum = checkSum();
618
619 if ( expectedChecksum != actualChecksum )
620 {
621 std::stringstream text;
622 text << "Expected CheckSum=" << actualChecksum
623 << ", Received CheckSum=" << expectedChecksum;
624 throw InvalidMessage(text.str());
625 }
626 }
627 catch ( FieldNotFound& e )
628 {
629 const std::string fieldName = ( e.field == FIX::FIELD::BodyLength ) ? "BodyLength" : "CheckSum";
630 throw InvalidMessage( fieldName + std::string(" is missing") );
631 }
632 catch ( IncorrectDataFormat& e )
633 {
634 const std::string fieldName = ( e.field == FIX::FIELD::BodyLength ) ? "BodyLength" : "CheckSum";
635 throw InvalidMessage( fieldName + std::string(" has wrong format: ") + e.detail );
636 }
637}
638
639FIX::FieldBase Message::extractField( const std::string& string, std::string::size_type& pos,
640 const DataDictionary* pSessionDD /*= 0*/, const DataDictionary* pAppDD /*= 0*/,
641 const Group* pGroup /*= 0*/ ) const
642{
643 std::string::const_iterator const tagStart = string.begin() + pos;
644 std::string::const_iterator const strEnd = string.end();
645
646 std::string::const_iterator const equalSign = std::find( tagStart, strEnd, '=' );
647 if( equalSign == strEnd )
648 throw InvalidMessage("Equal sign not found in field");
649
650 int field = 0;
651 if( !IntConvertor::convert( tagStart, equalSign, field ) )
652 throw InvalidMessage( std::string("Field tag is invalid: ") + std::string( tagStart, equalSign ));
653
654 std::string::const_iterator const valueStart = equalSign + 1;
655
656 std::string::const_iterator soh = std::find( valueStart, strEnd, '\001' );
657 if ( soh == strEnd )
658 throw InvalidMessage("SOH not found at end of field");
659
660 if ( IsDataField( field, pSessionDD, pAppDD ) )
661 {
662 // Assume length field is 1 less.
663 int lenField = field - 1;
664 // Special case for Signature which violates above assumption.
665 if ( field == FIELD::Signature ) lenField = FIELD::SignatureLength;
666
667 // identify part of the message that should contain length field
668 const FieldMap * location = pGroup;
669 if ( !location )
670 {
671 if ( isHeaderField( lenField, pSessionDD ) )
672 location = &m_header;
673 else if ( isTrailerField( lenField, pSessionDD ) )
674 location = &m_trailer;
675 else
676 location = this;
677 }
678
679 try
680 {
681 const FieldBase& fieldLength = location->reverse_find( lenField );
682 soh = valueStart + IntConvertor::convert( fieldLength.getString() );
683 }
684 catch( FieldNotFound& )
685 {
686 throw InvalidMessage( std::string( "Data length field " ) + IntConvertor::convert( lenField ) + std::string( " was not found for data field " ) + IntConvertor::convert( field ) );
687 }
688 catch( FieldConvertError& e )
689 {
690 throw InvalidMessage( std::string( "Unable to determine SOH for data field " ) + IntConvertor::convert( field ) + std::string( ": " ) + e.what() );
691 }
692 }
693
694 std::string::const_iterator const tagEnd = soh + 1;
695#if defined(__SUNPRO_CC)
696 std::distance( string.begin(), tagEnd, pos );
697#else
698 pos = std::distance( string.begin(), tagEnd );
699#endif
700
701 return FieldBase (
702 field,
703 valueStart,
704 soh,
705 tagStart,
706 tagEnd );
707}
708
709}
#define FIELD_GET_REF(MAP, FLD)
Definition FieldMap.h:376
Field that contains a checksum value.
Definition Field.h:525
Represents a data dictionary for a version of FIX.
bool isHeaderField(int field) const
bool isField(int field) const
bool getGroup(const std::string &msg, int field, int &delim, const DataDictionary *&pDataDictionary) const
message_order const & getOrderedFields() const
bool isTrailerField(int field) const
Base representation of all Field classes.
Definition Field.h:50
const std::string & getString() const
Get the string representation of the fields value.
Definition Field.h:152
int getTag() const
Get the fields integer tag.
Definition Field.h:144
Stores and organizes a collection of Fields.
Definition FieldMap.h:47
void setField(const FieldBase &field, bool overwrite=true)
Set a field without type checking.
Definition FieldMap.h:116
void sortFields()
Definition FieldMap.h:303
iterator begin()
Definition FieldMap.h:258
void appendField(const FieldBase &field)
Definition FieldMap.h:297
g_iterator g_begin()
Definition FieldMap.h:262
void removeField(int tag)
Remove a field. If field is not present, this is a no-op.
Definition FieldMap.cpp:156
Groups::const_iterator g_const_iterator
Definition FieldMap.h:102
iterator end()
Definition FieldMap.h:259
void addGroupPtr(int tag, FieldMap *group, bool setCount=true)
Acquire ownership of Group object.
Definition FieldMap.cpp:90
Fields::const_iterator const_iterator
Definition FieldMap.h:100
std::string & calculateString(std::string &) const
Definition FieldMap.cpp:215
const FieldBase & reverse_find(int tag) const
Definition FieldMap.h:286
g_iterator g_end()
Definition FieldMap.h:263
Base class for all FIX repeating groups.
Definition Group.h:41
Field that contains an integer value.
Definition Field.h:404
Base class for all FIX messages.
Definition Message.h:118
void clear()
Definition Message.h:291
SessionID getSessionID(const std::string &qualifier="") const
Returns the session ID of the intended recipient.
Definition Message.cpp:576
static bool InitializeXML(const std::string &string)
Set global data dictionary for encoding messages into XML.
Definition Message.cpp:139
int bodyLength(int beginStringField=FIELD::BeginString, int bodyLengthField=FIELD::BodyLength, int checkSumField=FIELD::CheckSum) const
Definition Message.h:258
Trailer m_trailer
Definition Message.h:398
void validate() const
Definition Message.cpp:597
static bool isHeaderField(int field)
Definition Message.cpp:497
static bool IsDataField(int field, const DataDictionary *pSessionDD, const DataDictionary *pAppDD)
Definition Message.h:379
const Trailer & getTrailer() const
Getter for the message trailer.
Definition Message.h:249
bool setStringHeader(const std::string &string)
Set a messages header from a string This is an optimization that can be used to get useful informatio...
Definition Message.cpp:475
static bool isTrailerField(int field)
Definition Message.cpp:550
void setString(const std::string &string)
Set a message based on a string representation This will fill in the fields on the message by parsing...
Definition Message.h:215
std::string toXMLFields(const FieldMap &fields, int space) const
Definition Message.cpp:295
friend class DataDictionary
Definition Message.h:119
std::string toXML() const
Get a XML representation of the message.
Definition Message.cpp:270
int checkSum(int checkSumField=FIELD::CheckSum) const
Definition Message.h:266
std::string toString(int beginStringField=FIELD::BeginString, int bodyLengthField=FIELD::BodyLength, int checkSumField=FIELD::CheckSum) const
Get a string representation of the message.
Definition Message.cpp:236
void setSessionID(const SessionID &sessionID)
Sets the session ID of the intended recipient.
Definition Message.cpp:590
static SmartPtr< DataDictionary > s_dataDictionary
Definition Message.h:404
void reverseRoute(const Header &)
Add header informations depending on a source message.
Definition Message.cpp:150
Header m_header
Definition Message.h:397
const Header & getHeader() const
Getter for the message header.
Definition Message.h:245
FieldBase extractField(const std::string &string, std::string::size_type &pos, const DataDictionary *pSessionDD=0, const DataDictionary *pAppDD=0, const Group *pGroup=0) const
Definition Message.cpp:639
void setGroup(const std::string &msg, const FieldBase &field, const std::string &string, std::string::size_type &pos, FieldMap &map, const DataDictionary &dataDictionary)
Definition Message.cpp:431
Unique session id consists of BeginString, SenderCompID and TargetCompID.
Definition SessionID.h:31
const SenderCompID & getSenderCompID() const
Definition SessionID.h:55
const BeginString & getBeginString() const
Definition SessionID.h:53
const TargetCompID & getTargetCompID() const
Definition SessionID.h:57
const char BeginString_FIX41[]
Definition Values.h:35
int const headerOrder[]
Definition Message.cpp:34
Application is not configured correctly
Definition Exceptions.h:88
std::string detail
Definition Exceptions.h:42
Unable to convert field into its native format.
Definition Exceptions.h:67
Field not found inside a message.
Definition Exceptions.h:58
Field has a badly formatted value.
Definition Exceptions.h:147
static std::string convert(signed_int value)
Not a recognizable message.
Definition Exceptions.h:81
Sorts fields in header, normal, or trailer order.

Generated on Sat Feb 3 2024 04:23:15 for QuickFIX by doxygen 1.9.8 written by Dimitri van Heesch, © 1997-2001