FIX::SessionID Class Reference

Unique session id consists of BeginString, SenderCompID and TargetCompID. More...

`#include <SessionID.h>`

## Public Member Functions

| SessionID ()
| SessionID (const std::string &beginString, const std::string &senderCompID, const std::string &targetCompID, const std::string &sessionQualifier="")
const BeginString & | getBeginString () const
const SenderCompID & | getSenderCompID () const
const TargetCompID & | getTargetCompID () const
const std::string & | getSessionQualifier () const
const bool | isFIXT () const
std::string | toString () const
| Get a string representation of the SessionID. More...
const std::string & | toStringFrozen () const
void | fromString (const std::string &str)
| Build from string representation of SessionID. More...
std::string & | toString (std::string &str) const
| Get a string representation without making a copy. More...
SessionID | operator~ () const

## Private Attributes

BeginString | m_beginString
SenderCompID | m_senderCompID
TargetCompID | m_targetCompID
std::string | m_sessionQualifier
bool | m_isFIXT
std::string | m_frozenString

## Friends

bool | operator< (const SessionID &, const SessionID &)
bool | operator== (const SessionID &, const SessionID &)
bool | operator!= (const SessionID &, const SessionID &)
std::ostream & | operator<< (std::ostream &, const SessionID &)
std::ostream & | operator>> (std::ostream &, const SessionID &)

## Detailed Description

Unique session id consists of BeginString, SenderCompID and TargetCompID.

Definition at line 30 of file SessionID.h.

## Constructor & Destructor Documentation

## SessionID() [1/2]

FIX::SessionID::SessionID | ( |  | ) |

inline

Definition at line 33 of file SessionID.h.

References m_frozenString, and toString().

Referenced by operator~().

{
toString(m_frozenString);
}
FIX::SessionID::toString
std::string toString() const
Get a string representation of the SessionID.
Definition: SessionID.h:65
FIX::SessionID::m_frozenString
std::string m_frozenString
Definition: SessionID.h:133

## SessionID() [2/2]

FIX::SessionID::SessionID | ( | const std::string & | beginString,
|  | const std::string & | senderCompID,
|  | const std::string & | targetCompID,
|  | const std::string & | sessionQualifier = `""`
| ) |  |

inline

Definition at line 38 of file SessionID.h.

References m_frozenString, m_isFIXT, and toString().

: m_beginString( BeginString(beginString) ),
m_senderCompID( SenderCompID(senderCompID) ),
m_targetCompID( TargetCompID(targetCompID) ),
m_sessionQualifier( sessionQualifier ),
m_isFIXT(false)
{
toString(m_frozenString);
if( beginString.substr(0, 4) == "FIXT" )
m_isFIXT = true;
}
FIX::SessionID::m_sessionQualifier
std::string m_sessionQualifier
Definition: SessionID.h:131
FIX::SessionID::m_beginString
BeginString m_beginString
Definition: SessionID.h:128
FIX::SessionID::toString
std::string toString() const
Get a string representation of the SessionID.
Definition: SessionID.h:65
FIX::SessionID::m_targetCompID
TargetCompID m_targetCompID
Definition: SessionID.h:130
FIX::FIELD::TargetCompID
const int TargetCompID
Definition: FixFieldNumbers.h:217
FIX::SessionID::m_senderCompID
SenderCompID m_senderCompID
Definition: SessionID.h:129
FIX::FIELD::SenderCompID
const int SenderCompID
Definition: FixFieldNumbers.h:124
FIX::SessionID::m_isFIXT
bool m_isFIXT
Definition: SessionID.h:132
FIX::FIELD::BeginString
const int BeginString
Definition: FixFieldNumbers.h:499
FIX::SessionID::m_frozenString
std::string m_frozenString
Definition: SessionID.h:133

## Member Function Documentation

## fromString()

void FIX::SessionID::fromString | ( | const std::string & | str | ) |

inline

Build from string representation of SessionID.

Definition at line 77 of file SessionID.h.

References m_beginString, m_frozenString, m_senderCompID, m_sessionQualifier, m_targetCompID, and toString().

{
std::string::size_type first =
str.find_first_of(':');
std::string::size_type second =
str.find("->");
std::string::size_type third =
str.find_last_of(':');
if( first == std::string::npos )
return;
if( second == std::string::npos )
return;
m_beginString = str.substr(0, first);
m_senderCompID = str.substr(first+1, second - first - 1);
if( first == third )
{
m_targetCompID = str.substr(second+2);
m_sessionQualifier = "";
}
else
{
m_targetCompID = str.substr(second+2, third - second - 2);
m_sessionQualifier = str.substr(third+1);
}
toString(m_frozenString);
}
FIX::SessionID::m_sessionQualifier
std::string m_sessionQualifier
Definition: SessionID.h:131
FIX::SessionID::m_beginString
BeginString m_beginString
Definition: SessionID.h:128
FIX::SessionID::toString
std::string toString() const
Get a string representation of the SessionID.
Definition: SessionID.h:65
FIX::SessionID::m_targetCompID
TargetCompID m_targetCompID
Definition: SessionID.h:130
FIX::SessionID::m_senderCompID
SenderCompID m_senderCompID
Definition: SessionID.h:129
FIX::SessionID::m_frozenString
std::string m_frozenString
Definition: SessionID.h:133

## getBeginString()

const BeginString& FIX::SessionID::getBeginString | ( |  | ) | const

inline

Definition at line 53 of file SessionID.h.

References m_beginString.

Referenced by FIX::FileStore::FileStore(), FIX::Session::fill(), FIX::FileLog::generatePrefix(), FIX::Session::generateReject(), FIX::Session::insertOrigSendingTime(), FIX::Session::insertSendingTime(), FIX::Session::next(), FIX::Session::nextResendRequest(), FIX::Session::populateRejectReason(), FIX::Message::setSessionID(), FIX::Session::shouldSendReset(), and toString().

{ return m_beginString; }
FIX::SessionID::m_beginString
BeginString m_beginString
Definition: SessionID.h:128

## getSenderCompID()

const SenderCompID& FIX::SessionID::getSenderCompID | ( |  | ) | const

inline

Definition at line 55 of file SessionID.h.

References m_senderCompID.

Referenced by FIX::FileStore::FileStore(), FIX::Session::fill(), FIX::FileLog::generatePrefix(), FIX::Session::isCorrectCompID(), FIX::Message::setSessionID(), and toString().

{ return m_senderCompID; }
FIX::SessionID::m_senderCompID
SenderCompID m_senderCompID
Definition: SessionID.h:129

## getSessionQualifier()

const std::string& FIX::SessionID::getSessionQualifier | ( |  | ) | const

inline

Definition at line 59 of file SessionID.h.

References m_sessionQualifier.

Referenced by FIX::FileStore::FileStore(), and FIX::FileLog::generatePrefix().

{ return m_sessionQualifier; }
FIX::SessionID::m_sessionQualifier
std::string m_sessionQualifier
Definition: SessionID.h:131

## getTargetCompID()

const TargetCompID& FIX::SessionID::getTargetCompID | ( |  | ) | const

inline

Definition at line 57 of file SessionID.h.

References m_targetCompID.

Referenced by FIX::FileStore::FileStore(), FIX::Session::fill(), FIX::FileLog::generatePrefix(), FIX::Session::isCorrectCompID(), FIX::Message::setSessionID(), and toString().

{ return m_targetCompID; }
FIX::SessionID::m_targetCompID
TargetCompID m_targetCompID
Definition: SessionID.h:130

## isFIXT()

const bool FIX::SessionID::isFIXT | ( |  | ) | const

inline

Definition at line 61 of file SessionID.h.

References m_isFIXT.

Referenced by FIX::Session::generateBusinessReject(), FIX::Session::generateLogon(), FIX::Session::next(), and FIX::Session::nextResendRequest().

{ return m_isFIXT; }
FIX::SessionID::m_isFIXT
bool m_isFIXT
Definition: SessionID.h:132

## operator~()

SessionID FIX::SessionID::operator~ | ( |  | ) | const

inline

Definition at line 121 of file SessionID.h.

References m_beginString, m_senderCompID, m_sessionQualifier, m_targetCompID, FIX::FIELD::SenderCompID, SessionID(), and FIX::FIELD::TargetCompID.

{
return SessionID( m_beginString, SenderCompID( m_targetCompID ),
TargetCompID( m_senderCompID ), m_sessionQualifier );
}
FIX::SessionID::m_sessionQualifier
std::string m_sessionQualifier
Definition: SessionID.h:131
FIX::SessionID::m_beginString
BeginString m_beginString
Definition: SessionID.h:128
FIX::SessionID::m_targetCompID
TargetCompID m_targetCompID
Definition: SessionID.h:130
FIX::FIELD::TargetCompID
const int TargetCompID
Definition: FixFieldNumbers.h:217
FIX::SessionID::m_senderCompID
SenderCompID m_senderCompID
Definition: SessionID.h:129
FIX::FIELD::SenderCompID
const int SenderCompID
Definition: FixFieldNumbers.h:124
FIX::SessionID::SessionID
SessionID()
Definition: SessionID.h:33

## toString() [1/2]

std::string FIX::SessionID::toString | ( |  | ) | const

inline

Get a string representation of the SessionID.

Definition at line 65 of file SessionID.h.

References m_frozenString.

Referenced by fromString(), FIX::HttpConnection::processRefreshSession(), FIX::HttpConnection::processResetSession(), and SessionID().

{
return m_frozenString;
}
FIX::SessionID::m_frozenString
std::string m_frozenString
Definition: SessionID.h:133

## toString() [2/2]

std::string& FIX::SessionID::toString | ( | std::string & | str | ) | const

inline

Get a string representation without making a copy.

Definition at line 105 of file SessionID.h.

References getBeginString(), getSenderCompID(), getTargetCompID(), m_sessionQualifier, operator!=, operator<, operator<<, operator==, and operator>>.

{
str = getBeginString().getValue() + ":" +
getSenderCompID().getValue() + "->" +
getTargetCompID().getValue();
if( m_sessionQualifier.size() )
str += ":" + m_sessionQualifier;
return str;
}
FIX::SessionID::m_sessionQualifier
std::string m_sessionQualifier
Definition: SessionID.h:131
FIX::SessionID::getTargetCompID
const TargetCompID & getTargetCompID() const
Definition: SessionID.h:57
FIX::SessionID::getBeginString
const BeginString & getBeginString() const
Definition: SessionID.h:53
FIX::SessionID::getSenderCompID
const SenderCompID & getSenderCompID() const
Definition: SessionID.h:55

## toStringFrozen()

const std::string& FIX::SessionID::toStringFrozen | ( |  | ) | const

inline

Definition at line 71 of file SessionID.h.

References m_frozenString.

Referenced by FIX::operator<(), and FIX::operator==().

{
return m_frozenString;
}
FIX::SessionID::m_frozenString
std::string m_frozenString
Definition: SessionID.h:133

## Friends And Related Function Documentation

## operator!=

bool operator!= | ( | const SessionID & | lhs,
|  | const SessionID & | rhs
| ) |  |

friend

Definition at line 147 of file SessionID.h.

Referenced by toString().

{
return !( lhs == rhs );
}

## operator<

bool operator< | ( | const SessionID & | lhs,
|  | const SessionID & | rhs
| ) |  |

friend

Definition at line 137 of file SessionID.h.

Referenced by toString().

{
return lhs.toStringFrozen() < rhs.toStringFrozen();
}

## operator<<

std::ostream& operator<< | ( | std::ostream & | stream,
|  | const SessionID & | sessionID
| ) |  |

friend

Definition at line 153 of file SessionID.h.

Referenced by toString().

{
stream << sessionID.toStringFrozen();
return stream;
}

## operator==

bool operator== | ( | const SessionID & | lhs,
|  | const SessionID & | rhs
| ) |  |

friend

Definition at line 142 of file SessionID.h.

Referenced by toString().

{
return lhs.toStringFrozen() == rhs.toStringFrozen();
}

## operator>>

std::ostream& operator>> | ( | std::ostream & | ,
|  | const SessionID & |
| ) |  |

friend

Referenced by toString().

## Member Data Documentation

## m_beginString

BeginString FIX::SessionID::m_beginString

private

Definition at line 128 of file SessionID.h.

Referenced by fromString(), getBeginString(), and operator~().

## m_frozenString

std::string FIX::SessionID::m_frozenString

private

Definition at line 133 of file SessionID.h.

Referenced by fromString(), SessionID(), toString(), and toStringFrozen().

## m_isFIXT

bool FIX::SessionID::m_isFIXT

private

Definition at line 132 of file SessionID.h.

Referenced by isFIXT(), and SessionID().

## m_senderCompID

SenderCompID FIX::SessionID::m_senderCompID

private

Definition at line 129 of file SessionID.h.

Referenced by fromString(), getSenderCompID(), and operator~().

## m_sessionQualifier

std::string FIX::SessionID::m_sessionQualifier

private

Definition at line 131 of file SessionID.h.

Referenced by fromString(), getSessionQualifier(), operator~(), and toString().

## m_targetCompID

TargetCompID FIX::SessionID::m_targetCompID

private

Definition at line 130 of file SessionID.h.

Referenced by fromString(), getTargetCompID(), and operator~().

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

- SessionID.h