B2BITS FIX Antenna C++  2.27.0
Public Types | Public Member Functions | Static Public Member Functions | Protected Member Functions | List of all members
Engine::FIXMsgProcessor Class Referenceabstract

Processes raw messages and provides message verification capabilities. More...

#include <B2BITS_FIXMsgProcessor.h>

Public Types

enum  Option {
  PROHIBIT_TAGS_WITHOUT_VALUE, VERIFY_DATA_TAGS_SEQUENCE, VERIFY_TAGS_VALUES, PROHIBIT_UNKNOWN_TAGS,
  PROHIBIT_DUPLICATED_TAGS, VERIFY_REPERATING_GROUP_BOUNDS, CHECK_REQUIRED_TAGS, CHECK_REQUIRED_GROUP_FIELDS,
  ALLOW_ZERO_NUMINGROUP, IGNORE_UNKNOWN_FIELDS
}
 List of options available to control message parsing flow. More...
 
enum  OptionState { ON, OFF }
 Option state. More...
 

Public Member Functions

virtual void check (const FIXMessage &fixMessage) const =0
 Checks that the message contains all required and conditionally required fields. More...
 
virtual void checkFields (const FIXMessage &fixMessage) const =0
 Checks that the message contains valid values of fields. More...
 
virtual FIXMessageclone (const FIXMessage &fixMessage) const =0
 Duplicates the given message. More...
 
virtual TagValueclone (const TagValue &instance) const =0
 Duplicates the given TagValue instance. More...
 
virtual FIXMessagecreateReject (const FIXMessage &fixMessage, bool appReject=true) const =0
 Creates corresponding reject for the source message. More...
 
virtual void fillRequired (FIXMessage &fixMessage) const =0
 Fills a message with required fields, blocks and repeating groups. More...
 
virtual OptionState optionState (Option option) const =0
 Returns the state of particular option. More...
 
virtual FIXMessageparse (char const *rawMessage, std::size_t rawMessageSize, SecurityAttributes *pSA=NULL, bool verifyBodyLength=false, bool verifyCheckSum=false, FIXVersion preferredVersion=NA) const =0
 Parses the input std::string and creates corresponding structured message. More...
 
virtual FIXMessageparse (ParserID parserID, const char *rawMessage, std::size_t rawMessageSize, SecurityAttributes *pSA=NULL, bool verifyBodyLength=false, bool verifyCheckSum=false, FIXVersion preferredVersion=NA) const =0
 Parses the input std::string and creates corresponding structured message. More...
 
FIXMessageparse (const std::string &rawMessage, SecurityAttributes *pSA=NULL, bool verifyBodyLength=false, bool verifyCheckSum=false, FIXVersion preferredVersion=NA) const
 Parses the input std::string and creates corresponding structured message. More...
 
FIXMessageparse (ParserID parserID, const std::string &rawMessage, SecurityAttributes *pSA=NULL, bool verifyBodyLength=false, bool verifyCheckSum=false, FIXVersion preferredVersion=NA) const
 Parses the input std::string and creates corresponding structured message. More...
 
virtual void switchOption (Option option, OptionState state)=0
 Changes state of particular parsing option. More...
 

Static Public Member Functions

static FIXMsgProcessorsingleton ()
 Returns the instance of the class. More...
 

Protected Member Functions

 FIXMsgProcessor ()
 Constructor. More...
 
virtual ~FIXMsgProcessor ()
 Destructor. More...
 

Detailed Description

Processes raw messages and provides message verification capabilities.

Member Enumeration Documentation

◆ Option

List of options available to control message parsing flow.

Enumerator
PROHIBIT_TAGS_WITHOUT_VALUE 

Message is treated as invalid if tag without value appeared.

VERIFY_DATA_TAGS_SEQUENCE 

Controls order and length of raw data fields pair verification.

VERIFY_TAGS_VALUES 

Enables/disables the verification of tag values (like date-time).

PROHIBIT_UNKNOWN_TAGS 

Controls collecting of unknown tags while message parsing.

PROHIBIT_DUPLICATED_TAGS 

Message is treated as invalid if any tag appears more than once.

VERIFY_REPERATING_GROUP_BOUNDS 

Message is treated as invalid if the quantity of repeating group entries is less than specified in the leading field.

Message with exceeding quantity of repeating group entries is allways treated as invalid.

CHECK_REQUIRED_TAGS 

Verifies the presence of required and conditionally required tags of the message.

CHECK_REQUIRED_GROUP_FIELDS 

Verifies the presence of required fields in repeating groups .

ALLOW_ZERO_NUMINGROUP 

When true, parser will ignore group tags with 0 values.

Exception fired otherwise.

IGNORE_UNKNOWN_FIELDS 

When true, parser will ignore unknown fields.

◆ OptionState

Option state.

Enumerator
ON 

Turns option on.

OFF 

Turns option off.

Constructor & Destructor Documentation

◆ FIXMsgProcessor()

Engine::FIXMsgProcessor::FIXMsgProcessor ( )
inlineprotected

Constructor.

◆ ~FIXMsgProcessor()

virtual Engine::FIXMsgProcessor::~FIXMsgProcessor ( )
protectedvirtual

Destructor.

Member Function Documentation

◆ check()

virtual void Engine::FIXMsgProcessor::check ( const FIXMessage fixMessage) const
pure virtual

Checks that the message contains all required and conditionally required fields.

Parameters
fixMessageFIXMessage to check.
Exceptions
Utils::Exceptionif any required and conditionally required field is absent.

◆ checkFields()

virtual void Engine::FIXMsgProcessor::checkFields ( const FIXMessage fixMessage) const
pure virtual

Checks that the message contains valid values of fields.

Parameters
fixMessageFIXMessage to check.
Exceptions
Utils::Exceptionif any field contains invalid value

◆ clone() [1/2]

virtual FIXMessage* Engine::FIXMsgProcessor::clone ( const FIXMessage fixMessage) const
pure virtual

Duplicates the given message.

Parameters
fixMessagemessage to duplicate
Returns
duplicated FIXMessage

◆ clone() [2/2]

virtual TagValue* Engine::FIXMsgProcessor::clone ( const TagValue instance) const
pure virtual

Duplicates the given TagValue instance.

Parameters
instanceTagValue instance to duplicate
Returns
copy of the passed TagValue instance

◆ createReject()

virtual FIXMessage* Engine::FIXMsgProcessor::createReject ( const FIXMessage fixMessage,
bool  appReject = true 
) const
pure virtual

Creates corresponding reject for the source message.

Parameters
fixMessagemessage to be rejected
appRejectwhen true application reject will be created, session when false
Returns
reject FIXMessage

◆ fillRequired()

virtual void Engine::FIXMsgProcessor::fillRequired ( FIXMessage fixMessage) const
pure virtual

Fills a message with required fields, blocks and repeating groups.

Parameters
fixMessageFIXMessage to fill.
Warning
Method throws Utils::Exception in case of message or protocol is not defined.

◆ optionState()

virtual OptionState Engine::FIXMsgProcessor::optionState ( Option  option) const
pure virtual

Returns the state of particular option.

Parameters
optionOption to ckeck
Returns
the state of particular option.

◆ parse() [1/4]

virtual FIXMessage* Engine::FIXMsgProcessor::parse ( char const *  rawMessage,
std::size_t  rawMessageSize,
SecurityAttributes *  pSA = NULL,
bool  verifyBodyLength = false,
bool  verifyCheckSum = false,
FIXVersion  preferredVersion = NA 
) const
pure virtual

Parses the input std::string and creates corresponding structured message.

Parameters
rawMessagemessage to parse.
rawMessageSizeSize of the message to parse.
pSApointer to SecurityAttributes class to decrypt input message. This parameter may be NULL if input message wasn't encrypted.
verifyBodyLengthif true then conformance of the input message length to the 'BodyLength' field (tag 9) value will be checked.
verifyCheckSumif true then conformance of the input message checksum to the 'CheckSum' field (tag 10) value will be checked.
preferredVersionforces to use specified FIX version instead of using 'BeginString' field (tag 8) value.
Warning
the user is responsible for the deletion.
Returns
Instance of FIXMessage class.

◆ parse() [2/4]

virtual FIXMessage* Engine::FIXMsgProcessor::parse ( ParserID  parserID,
const char *  rawMessage,
std::size_t  rawMessageSize,
SecurityAttributes *  pSA = NULL,
bool  verifyBodyLength = false,
bool  verifyCheckSum = false,
FIXVersion  preferredVersion = NA 
) const
pure virtual

Parses the input std::string and creates corresponding structured message.

Parameters
parserIDUnique FIX parser identifier of the passed message.
rawMessageMessage to parse.
rawMessageSizeMessage size.
pSApointer to SecurityAttributes class to decrypt input message. This parameter may be NULL if input message wasn't encrypted.
verifyBodyLengthif true then conformance of the input message length to the 'BodyLength' field (tag 9) value will be checked.
verifyCheckSumif true then conformance of the input message checksum to the 'CheckSum' field (tag 10) value will be checked.
preferredVersionforces to use specified FIX version instead of using 'BeginString' field (tag 8) value.
Warning
the user is responsible for the deletion.
Returns
Instance of FIXMessage class.

◆ parse() [3/4]

FIXMessage* Engine::FIXMsgProcessor::parse ( const std::string &  rawMessage,
SecurityAttributes *  pSA = NULL,
bool  verifyBodyLength = false,
bool  verifyCheckSum = false,
FIXVersion  preferredVersion = NA 
) const
inline

Parses the input std::string and creates corresponding structured message.

Parameters
rawMessagemessage to parse.
pSApointer to SecurityAttributes class to decrypt input message. This parameter may be NULL if input message wasn't encrypted.
verifyBodyLengthif true then conformance of the input message length to the 'BodyLength' field (tag 9) value will be checked.
verifyCheckSumif true then conformance of the input message checksum to the 'CheckSum' field (tag 10) value will be checked.
preferredVersionforces to use specified FIX version instead of using 'BeginString' field (tag 8) value.
Warning
the user is responsible for the deletion.
Returns
Instance of FIXMessage class.

◆ parse() [4/4]

FIXMessage* Engine::FIXMsgProcessor::parse ( ParserID  parserID,
const std::string &  rawMessage,
SecurityAttributes *  pSA = NULL,
bool  verifyBodyLength = false,
bool  verifyCheckSum = false,
FIXVersion  preferredVersion = NA 
) const
inline

Parses the input std::string and creates corresponding structured message.

Parameters
parserIDUnique FIX parser identifier of the passed message.
rawMessagemessage to parse.
pSApointer to SecurityAttributes class to decrypt input message. This parameter may be NULL if input message wasn't encrypted.
verifyBodyLengthif true then conformance of the input message length to the 'BodyLength' field (tag 9) value will be checked.
verifyCheckSumif true then conformance of the input message checksum to the 'CheckSum' field (tag 10) value will be checked.
preferredVersionforces to use specified FIX version instead of using 'BeginString' field (tag 8) value.
Warning
the user is responsible for the deletion.
Returns
Instance of FIXMessage class.

◆ singleton()

static FIXMsgProcessor* Engine::FIXMsgProcessor::singleton ( )
static

Returns the instance of the class.

◆ switchOption()

virtual void Engine::FIXMsgProcessor::switchOption ( Option  option,
OptionState  state 
)
pure virtual

Changes state of particular parsing option.

Parameters
optionOption to change
stateNew state