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

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

Collaboration diagram for Message:

Public Member Functions

 Message ()
 
 Message (const char *type, const Dictionary &dictionary)
 
 Message (const Message &other)
 
 ~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
 
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
 
void updateBodyLengthAndCheckSum ()
 
Messageoperator= (const Message &)
 
void copyFields (const Message &)
 
- Public Member Functions inherited from FieldSet
 operator bool () 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, TimestampFormat::Enum=TimestampFormat::YYYYMMDDHHMMSSNsec) const
 
TimeSpan getTimeSpan (Tag tag) const
 
Group getGroup (Tag numberOfInstancesTag) const
 
bool hasFlag (Tag tag) const
 
bool set (Tag tag, Int32 value)
 
bool setV (Tag tag, Int32 value)
 
bool set (Tag tag, UInt32 value)
 
bool setV (Tag tag, UInt32 value)
 
bool set (Tag tag, Int64 value)
 
bool setV (Tag tag, Int64 value)
 
bool set (Tag tag, UInt64 value)
 
bool setV (Tag tag, UInt64 value)
 
bool set (Tag tag, Double value, size_t precision=17)
 
bool set (Tag tag, Double value, size_t precision, size_t length)
 
bool setV (Tag tag, Double value, size_t precision=17)
 
bool setV (Tag tag, Double value, size_t precision, size_t length)
 
bool set (Tag tag, const Decimal &value)
 
bool set (Tag tag, const Decimal &value, size_t length)
 
bool setV (Tag tag, const Decimal &value)
 
bool setV (Tag tag, const Decimal &value, size_t length)
 
bool set (Tag tag, char value)
 
bool set (Tag tag, const std::string &value)
 
bool set (Tag tag, const char *value)
 
bool set (Tag tag, const StringRef &value)
 
bool set (Tag tag, const Timestamp &value, TimestampFormat::Enum valueFormat=TimestampFormat::YYYYMMDDHHMMSSNsec)
 
bool setV (Tag tag, const Timestamp &value, TimestampFormat::Enum valueFormat=TimestampFormat::YYYYMMDDHHMMSSNsec)
 
bool set (Tag tag, const TimeSpan &value, TimeSpanFormat::Enum valueFormat=TimeSpanFormat::HHMMSSNsec)
 
bool setV (Tag tag, const TimeSpan &value, TimeSpanFormat::Enum valueFormat=TimeSpanFormat::HHMMSSNsec)
 
Group setGroup (Tag tag, size_t value)
 
bool setFlag (Tag tag, bool value)
 
bool set (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)
 

Friends

class MessageWrapper
 
class MessageOperator
 

Additional Inherited Members

- Protected Types inherited from FieldSet
typedef size_t AccessPolicies
 
- Protected Member Functions inherited from FieldSet
 FieldSet ()
 
 FieldSet (const Message *, void *, AccessPolicies)
 
 FieldSet (const FieldSet &)
 
 ~FieldSet ()
 
FieldSetoperator= (const FieldSet &)
 
void swap (FieldSet &)
 
- Protected Attributes inherited from FieldSet
void * impl_
 
const Messagecontainer_
 
AccessPolicies policies_
 

Detailed Description

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

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

Definition at line 49 of file Message.h.

Constructor & Destructor Documentation

Message ( )

Initializes message in un-constructed state.

Message ( const char *  type,
const Dictionary dictionary 
)

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

Parameters
typeDefines type of message (MsgType field value).
dictionaryFIX protocol dictionary to which message belongs to.
Warning
Type of the message can't be changed by updating MsgType field value. Changing MsgType field value have no effect for known message which are defined by the dictionary associated with message.
Message ( const Message other)

Initializes instance as deep copy of other one.

Parameters
otherMessage to be copied from.
~Message ( )

Disposes all internal data structures.

Warning
Once instance is destructed, all instances of OnixS::FIX::Group and OnixS::FIX::GroupInstance classes obtained from this instance must not be used any more.

Member Function Documentation

void clear ( )

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

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

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

bool operator!= ( const Message ) const

Compares two messages.

Comparison is performed using 'tag=value' message presentations.

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

Compares two messages.

Comparison is performed using 'tag=value' message presentations.

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

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

Parameters
rawMessagebuffer in which raw FIX message is stored.
rawMessageSizeSize of buffer in which raw FIX message is stored.
messageparsed FIX message if parsing succeeds.
Exceptions
std::exceptionif parsing fails.
static void parse ( const char *  rawMessage,
size_t  rawMessageSize,
MessageParsingFlags  parsingFlags,
Message message 
)
static

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

Parameters
rawMessagebuffer in which raw FIX message is stored.
rawMessageSizeSize of buffer in which raw FIX message is stored.
parsingFlagsflags which affect parsing behavior.
messageparsed FIX message if parsing succeeds.
Exceptions
std::exceptionif parsing fails.
static void parse ( const char *  rawMessage,
size_t  rawMessageSize,
const Dictionary dictionary,
MessageParsingFlags  parsingFlags,
Message message 
)
static

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

Parameters
rawMessagebuffer in which raw FIX message is stored.
rawMessageSizeSize of buffer in which raw FIX message is stored.
dictionaryFIX dictionary to which message supposed to belong.
parsingFlagsflags which affect parsing behavior.
messageparsed FIX message if parsing succeeds.
Exceptions
std::exceptionif parsing fails.
static bool parsePartial ( const char *  rawMessage,
size_t  rawMessageSize,
Message message 
)
static

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

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

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

Parameters
rawMessagebuffer in which raw FIX message is stored.
rawMessageSizeSize of buffer in which raw FIX message is stored.
dictionaryFIX dictionary to which message supposed to belong.
messageparsed FIX message if parsing succeeds.
Returns
true if message can be recognized from the input.
FieldValueRef senderCompId ( ) const

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

void senderCompId ( const std::string &  )

Sets the assigned value used to identify 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 receiving firm (TargetCompID(56) field value).

void targetCompId ( const std::string &  )

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

void toRaw ( RawMessage ) const

Builds 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 field delimiter to be used.
flagsAffect how message presentation looks like.

Definition at line 284 of file Message.h.

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

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

Parameters
strString to which presentation is appended.
delimiterDefines field delimiter to be used.
flagsAffect how message presentation looks like.
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

User data associated with the message.

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

Attaches user data to the message.

void validate ( ) const

Ensures message satisfies basic FIX Specification requirements.

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

Validates message according to specified criterias.

Parameters
validationFlagsSpecifies validation criterias.
Exceptions
std::exceptionif validation fails.
Note
This method validates required fields for the application level only, without header/trailer

Friends And Related Function Documentation

friend class MessageOperator
friend

Definition at line 270 of file Message.h.

friend class MessageWrapper
friend

Definition at line 269 of file Message.h.


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