OnixS C++ FIX Engine  4.10.1
API Documentation
Message Class Reference

#include <OnixS/FIXEngine/FIX/Message.h>

Classes

struct  MakeShallowCopy
 

Public Member Functions

 Message (size_t expectedMessageSize=DefaultExpectedMessageSize)
 
 Message (const char *type, const Dictionary &dictionary, size_t expectedMessageSize=DefaultExpectedMessageSize)
 
 Message (const Message &other)
 
virtual ~Message ()
 
Dictionary dictionary () const
 
FieldValueRef type () const
 
SequenceNumber seqNum () const
 
void seqNum (SequenceNumber value)
 
FieldValueRef senderCompId () const
 
void senderCompId (const std::string &)
 
FieldValueRef targetCompId () const
 
void targetCompId (const std::string &)
 
void * userData () const
 
void userData (void *data)
 
bool operator== (const Message &) const
 
bool operator!= (const Message &) const
 
void validate () const
 
void validate (MessageValidationFlags validationFlags) const
 
bool tryValidate (MessageValidationFlags validationFlags, std::string &errorDescription) const
 
void clear ()
 
void toRaw (RawMessage &) const
 
std::string toString (char delimiter=0x1, MessageStringingFlags flags=MessageStringingFlag::IncludeFieldTagNumber) const
 
void toString (std::string &str, char delimiter=0x1, MessageStringingFlags flags=MessageStringingFlag::IncludeFieldTagNumber) const
 
std::string toXml () const
 
void toXml (std::string &str) const
 
std::string toJson () const
 
void toJson (std::string &str) const
 
void updateBodyLengthAndCheckSum ()
 
Messageoperator= (const Message &)
 
void copyFields (const Message &)
 
- Public Member Functions inherited from FieldSet
bool valid () const
 
bool contain (Tag tag) const
 
FieldValueRef get (Tag tag) const
 
Char getChar (Tag tag) const
 
Int32 getInt32 (Tag tag) const
 
UInt32 getUInt32 (Tag tag) const
 
Int64 getInt64 (Tag tag) const
 
UInt64 getUInt64 (Tag tag) const
 
Double getDouble (Tag tag) const
 
Decimal getDecimal (Tag tag) const
 
Decimal getDecimal (Tag tag, Int32 exponent) const
 
StringRef getStringRef (Tag tag) const
 
Timestamp getTimestamp (Tag tag) const
 
Timestamp getTimestamp (Tag tag, TimestampFormat::Enum) const
 
TimeSpan getTimeSpan (Tag tag) const
 
Group getGroup (Tag numberOfInstancesTag) const
 
bool hasFlag (Tag tag) const
 
FieldSetset (Tag tag, Int32 value)
 
FieldSetsetV (Tag tag, Int32 value)
 
FieldSetset (Tag tag, UInt32 value)
 
FieldSetsetV (Tag tag, UInt32 value)
 
FieldSetset (Tag tag, Int64 value)
 
FieldSetsetV (Tag tag, Int64 value)
 
FieldSetset (Tag tag, UInt64 value)
 
FieldSetsetV (Tag tag, UInt64 value)
 
FieldSetset (Tag tag, Double value, size_t precision=17)
 
FieldSetset (Tag tag, Double value, size_t precision, size_t length)
 
FieldSetsetV (Tag tag, Double value, size_t precision=17)
 
FieldSetsetV (Tag tag, Double value, size_t precision, size_t length)
 
FieldSetset (Tag tag, const Decimal &value)
 
FieldSetset (Tag tag, const Decimal &value, size_t length)
 
FieldSetsetV (Tag tag, const Decimal &value)
 
FieldSetsetV (Tag tag, const Decimal &value, size_t length)
 
FieldSetset (Tag tag, char value)
 
FieldSetset (Tag tag, const std::string &value)
 
FieldSetset (Tag tag, const char *value)
 
FieldSetset (Tag tag, const StringRef &value)
 
FieldSetset (Tag tag, const Timestamp &value, TimestampFormat::Enum valueFormat=TimestampFormat::YYYYMMDDHHMMSSNsec)
 
FieldSetsetV (Tag tag, const Timestamp &value, TimestampFormat::Enum valueFormat=TimestampFormat::YYYYMMDDHHMMSSNsec)
 
FieldSetset (Tag tag, const TimeSpan &value, TimeSpanFormat::Enum valueFormat=TimeSpanFormat::HHMMSSNsec)
 
FieldSetsetV (Tag tag, const TimeSpan &value, TimeSpanFormat::Enum valueFormat=TimeSpanFormat::HHMMSSNsec)
 
Group setGroup (Tag tag, size_t value)
 
FieldSetsetFlag (Tag tag, bool value)
 
FieldSetset (Tag tag, const FieldValueRef &value)
 
bool erase (Tag tag)
 
size_t fields (Fields &fields) const
 
ConstIterator begin () const
 
ConstIterator end () const
 

Static Public Member Functions

static void parse (const char *rawMessage, size_t rawMessageSize, Message &message)
 
static void parse (const char *rawMessage, size_t rawMessageSize, MessageParsingFlags parsingFlags, Message &message)
 
static void parse (const char *rawMessage, size_t rawMessageSize, const Dictionary &dictionary, MessageParsingFlags parsingFlags, Message &message)
 
static bool parsePartial (const char *rawMessage, size_t rawMessageSize, Message &message)
 
static bool parsePartial (const char *rawMessage, size_t rawMessageSize, const Dictionary &dictionary, Message &message)
 

Protected Member Functions

 Message (const Message &other, MakeShallowCopy)
 
- Protected Member Functions inherited from FieldSet
 FieldSet ()
 
 FieldSet (const Message *, void *, AccessPolicies)
 
 FieldSet (const FieldSet &)
 
 ~FieldSet () ONIXS_FIXENGINE_DEFAULT
 
FieldSetoperator= (const FieldSet &)
 
void swap (FieldSet &)
 

Friends

class MessageWrapper
 
class MessageOperator
 

Additional Inherited Members

- Protected Types inherited from FieldSet
typedef size_t AccessPolicies
 
- Protected Attributes inherited from FieldSet
void * impl_
 
const Messagecontainer_
 
AccessPolicies policies_
 

Detailed Description

Message supports the 'unconstructed' state which can be treated as a pointer in the null state. However, in contrast to OnixS::FIX::Group and OnixS::FIX::GroupInstance classes it does NOT represent a light-weight wrapper over internal structures. In fact, it holds all the data which is fully copied on an assignment or a copy construction and disposed at the instance destruction.

FIX field related operations now available via the OnixS::FIX::FieldSet class from which the OnixS::FIX::Message class is now derived.

Definition at line 49 of file Message.h.

Constructor & Destructor Documentation

Message ( size_t  expectedMessageSize = DefaultExpectedMessageSize)
explicit

Initializes a message in the unconstructed state.

Parameters
expectedMessageSizeAn expected size of the FIX message. The 'expectedMessageSize' parameter is used as a hint for the optimization of the manipulation (parsing, setting, etc.) of large FIX messages with a lot of repeating groups.
Note
The large value of the 'expectedMessageSize' parameter can increase the memory consumption by the Message object, so try to increase the value only in case of a latency degradation of the large FIX messages manipulation.
Message ( const char *  type,
const Dictionary dictionary,
size_t  expectedMessageSize = DefaultExpectedMessageSize 
)

Constructs a FIX message of the given type which belongs to the given dictionary of the FIX protocol (messaging specification).

Parameters
typeDefines the type of the message (MsgType field value).
dictionaryThe FIX protocol dictionary to which the message belongs to.
expectedMessageSizeAn expected size of the FIX message. The 'expectedMessageSize' parameter is used as a hint for the optimization of the manipulation (parsing, setting, etc.) of large FIX messages with a lot of repeating groups.
Note
The large value of the 'expectedMessageSize' parameter can increase the memory consumption by the Message object, so try to increase the value only in case of a latency degradation of the large FIX messages manipulation.
Warning
The type of the message can't be changed by updating the MsgType field value. Changing the MsgType field value have no effect for the known message which are defined by the dictionary associated with message.
Message ( const Message other)

Initializes an instance as a deep copy of other one.

Parameters
otherThe message to be copied from.
virtual ~Message ( )
virtual

Disposes all internal data structures.

Warning
Once an instance is destructed, all instances of OnixS::FIX::Group and OnixS::FIX::GroupInstance classes obtained from this instance must not be used any more.
Message ( const Message other,
MakeShallowCopy   
)
protected

Initializes an instance as a shallow copy of other one.

Parameters
otherThe message to be copied from.

Member Function Documentation

void clear ( )

Brings the message to the 'blank' state as it was just constructed.

Warning
For messages constructed with the certain message type member wipes out field values for all the fields except several service fields (MsgType, BeginString, etc). For the message in the unconstructed state does actually nothing.
void copyFields ( const Message )
Dictionary dictionary ( ) const

An instance of the FIX dictionary or standard FIX messages dictionary to which the message belongs to.

bool operator!= ( const Message ) const

Compares two messages.

The comparison is performed using 'tag=value' message presentations.

Message& operator= ( const Message )
bool operator== ( const Message ) const

Compares two messages.

The comparison is performed using 'tag=value' message presentations.

static void parse ( const char *  rawMessage,
size_t  rawMessageSize,
Message message 
)
static

De-serializes the FIX message from its raw (tag=value) presentation.

Parameters
rawMessageThe buffer in which the raw FIX message is stored.
rawMessageSizeThe size of the buffer in which the raw FIX message is stored.
messageThe parsed FIX message if the parsing succeeds.
Exceptions
Thestd::exception if the parsing fails.
static void parse ( const char *  rawMessage,
size_t  rawMessageSize,
MessageParsingFlags  parsingFlags,
Message message 
)
static

De-serializes the FIX message from its raw (tag=value) presentation.

Parameters
rawMessageThe buffer in which the raw FIX message is stored.
rawMessageSizeThe Size of the buffer in which the raw FIX message is stored.
parsingFlagsFlags which affect the parsing behavior.
messageThe parsed FIX message if the parsing succeeds.
Exceptions
Thestd::exception if the parsing fails.
static void parse ( const char *  rawMessage,
size_t  rawMessageSize,
const Dictionary dictionary,
MessageParsingFlags  parsingFlags,
Message message 
)
static

De-serializes the FIX message from its raw (tag=value) presentation.

Parameters
rawMessageThe buffer in which the raw FIX message is stored.
rawMessageSizeThe Size of the buffer in which the raw FIX message is stored.
dictionaryThe FIX dictionary to which the message supposed to belong.
parsingFlagsFlags which affect the parsing behavior.
messageThe parsed FIX message if the parsing succeeds.
Exceptions
Thestd::exception if the parsing fails.
static bool parsePartial ( const char *  rawMessage,
size_t  rawMessageSize,
Message message 
)
static

De-serializes the FIX message from its raw (tag=value) presentation which may be truncated.

Parameters
rawMessageThe buffer in which the raw FIX message is stored.
rawMessageSizeThe Size of the buffer in which the raw FIX message is stored.
messageThe parsed FIX message if the parsing succeeds.
Returns
true if the message can be recognized from the input.
static bool parsePartial ( const char *  rawMessage,
size_t  rawMessageSize,
const Dictionary dictionary,
Message message 
)
static

De-serializes the FIX message from its raw (tag=value) presentation which may be truncated.

Parameters
rawMessageThe buffer in which the raw FIX message is stored.
rawMessageSizeThe Size of the buffer in which the raw FIX message is stored.
dictionaryThe FIX dictionary to which the message supposed to belong.
messageThe parsed FIX message if the parsing succeeds.
Returns
true if the message can be recognized from the input.
FieldValueRef senderCompId ( ) const

Returns the assigned value used to identify the firm sending message (SenderCompID (49) field value).

void senderCompId ( const std::string &  )

Sets the assigned value used to identify the firm sending message (SenderCompID (49) field value).

SequenceNumber seqNum ( ) const

Returns the message sequence number (the MsgSeqNum (tag=34) field value).

void seqNum ( SequenceNumber  value)

Sets the message sequence number (the MsgSeqNum (tag=34) field value).

FieldValueRef targetCompId ( ) const

Returns the assigned value used to identify the receiving firm (TargetCompID(56) field value).

void targetCompId ( const std::string &  )

Sets the assigned value used to identify the receiving firm (TargetCompID(56) field value).

std::string toJson ( ) const

Returns the JSON representation of the message.

void toJson ( std::string &  str) const

Appends the JSON representation of the message.

Parameters
strThe string to which the presentation is appended.
void toRaw ( RawMessage ) const

Builds the FIX-compliant 'tag=value' presentation of the message.

std::string toString ( char  delimiter = 0x1,
MessageStringingFlags  flags = MessageStringingFlag::IncludeFieldTagNumber 
) const
inline

Returns the string representation of the message using the given delimiter and additional control flags.

Parameters
delimiterDefines the field delimiter to be used.
flagsAffects how the message presentation looks like.

Definition at line 339 of file Message.h.

void toString ( std::string &  str,
char  delimiter = 0x1,
MessageStringingFlags  flags = MessageStringingFlag::IncludeFieldTagNumber 
) const

Appends the string representation of the message using the given delimiter and additional control flags.

Parameters
strThe string to which the presentation is appended.
delimiterDefines the field delimiter to be used.
flagsAffects how the message presentation looks like.
std::string toXml ( ) const

Returns the XML representation of the message.

void toXml ( std::string &  str) const

Appends the XML representation of the message.

Parameters
strThe string to which the presentation is appended.
bool tryValidate ( MessageValidationFlags  validationFlags,
std::string &  errorDescription 
) const

Tries to validate the message according to specified criteria.

Returns 'true' if the validation is successful, otherwise - 'false'.

Parameters
validationFlagsValidation criteria.
errorDescriptionContains the error description in case the validation fails.
Note
This method validates required fields for the application level only, without the message header/trailer
FieldValueRef type ( ) const

Returns the message type (MsgType(35) field value).

void updateBodyLengthAndCheckSum ( )

Calculates the message body length and checkSum and updates corresponding fields.

void* userData ( ) const

A user data associated with the message.

Returns
The pointer to data was previously attached to the instance or NULL.
void userData ( void *  data)

Attaches a user data to the message.

void validate ( ) const

Ensures the message satisfies basic FIX Specification requirements.

Exceptions
Thestd::exception if the validation fails.
Note
This method validates required fields for the application level only, without the message header/trailer
void validate ( MessageValidationFlags  validationFlags) const

Validates the message according to specified criteria.

Parameters
validationFlagsSpecifies validation criteria.
Exceptions
Thestd::exception if the validation fails.
Note
This method validates required fields for the application level only, without the message header/trailer

Friends And Related Function Documentation

friend class MessageOperator
friend

Definition at line 320 of file Message.h.

friend class MessageWrapper
friend

Definition at line 319 of file Message.h.


The documentation for this class was generated from the following file: