Public Member Functions | Private Attributes | Friends | List of all members
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

FIX::SessionID::SessionID ( )
inline

Definition at line 33 of file SessionID.h.

References m_frozenString, and toString().

Referenced by operator~().

34  {
36  }
std::string toString() const
Get a string representation of the SessionID.
Definition: SessionID.h:65
std::string m_frozenString
Definition: SessionID.h:133
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().

42  : m_beginString( BeginString(beginString) ),
43  m_senderCompID( SenderCompID(senderCompID) ),
44  m_targetCompID( TargetCompID(targetCompID) ),
45  m_sessionQualifier( sessionQualifier ),
46  m_isFIXT(false)
47  {
49  if( beginString.substr(0, 4) == "FIXT" )
50  m_isFIXT = true;
51  }
std::string m_sessionQualifier
Definition: SessionID.h:131
BeginString m_beginString
Definition: SessionID.h:128
std::string toString() const
Get a string representation of the SessionID.
Definition: SessionID.h:65
TargetCompID m_targetCompID
Definition: SessionID.h:130
const int TargetCompID
SenderCompID m_senderCompID
Definition: SessionID.h:129
const int SenderCompID
const int BeginString
std::string m_frozenString
Definition: SessionID.h:133

Member Function Documentation

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().

78  {
79  std::string::size_type first =
80  str.find_first_of(':');
81  std::string::size_type second =
82  str.find("->");
83  std::string::size_type third =
84  str.find_last_of(':');
85  if( first == std::string::npos )
86  return;
87  if( second == std::string::npos )
88  return;
89  m_beginString = str.substr(0, first);
90  m_senderCompID = str.substr(first+1, second - first - 1);
91  if( first == third )
92  {
93  m_targetCompID = str.substr(second+2);
94  m_sessionQualifier = "";
95  }
96  else
97  {
98  m_targetCompID = str.substr(second+2, third - second - 2);
99  m_sessionQualifier = str.substr(third+1);
100  }
102  }
std::string m_sessionQualifier
Definition: SessionID.h:131
BeginString m_beginString
Definition: SessionID.h:128
std::string toString() const
Get a string representation of the SessionID.
Definition: SessionID.h:65
TargetCompID m_targetCompID
Definition: SessionID.h:130
SenderCompID m_senderCompID
Definition: SessionID.h:129
std::string m_frozenString
Definition: SessionID.h:133
const BeginString& FIX::SessionID::getBeginString ( ) const
inline
const SenderCompID& FIX::SessionID::getSenderCompID ( ) const
inline
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().

60  { return m_sessionQualifier; }
std::string m_sessionQualifier
Definition: SessionID.h:131
const TargetCompID& FIX::SessionID::getTargetCompID ( ) const
inline
const bool FIX::SessionID::isFIXT ( ) const
inline
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.

122  {
125  }
std::string m_sessionQualifier
Definition: SessionID.h:131
BeginString m_beginString
Definition: SessionID.h:128
TargetCompID m_targetCompID
Definition: SessionID.h:130
const int TargetCompID
SenderCompID m_senderCompID
Definition: SessionID.h:129
const int SenderCompID
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().

66  {
67  return m_frozenString;
68  }
std::string m_frozenString
Definition: SessionID.h:133
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(), and m_sessionQualifier.

106  {
107  str = getBeginString().getValue() + ":" +
108  getSenderCompID().getValue() + "->" +
109  getTargetCompID().getValue();
110  if( m_sessionQualifier.size() )
111  str += ":" + m_sessionQualifier;
112  return str;
113  }
std::string m_sessionQualifier
Definition: SessionID.h:131
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 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==().

72  {
73  return m_frozenString;
74  }
std::string m_frozenString
Definition: SessionID.h:133

Friends And Related Function Documentation

bool operator!= ( const SessionID lhs,
const SessionID rhs 
)
friend

Definition at line 147 of file SessionID.h.

148 {
149  return !( lhs == rhs );
150 }
bool operator< ( const SessionID lhs,
const SessionID rhs 
)
friend

Definition at line 137 of file SessionID.h.

138 {
139  return lhs.toStringFrozen() < rhs.toStringFrozen();
140 }
std::ostream& operator<< ( std::ostream &  stream,
const SessionID sessionID 
)
friend

Definition at line 153 of file SessionID.h.

154 {
155  stream << sessionID.toStringFrozen();
156  return stream;
157 }
bool operator== ( const SessionID lhs,
const SessionID rhs 
)
friend

Definition at line 142 of file SessionID.h.

143 {
144  return lhs.toStringFrozen() == rhs.toStringFrozen();
145 }
std::ostream& operator>> ( std::ostream &  ,
const SessionID  
)
friend

Member Data Documentation

BeginString FIX::SessionID::m_beginString
private

Definition at line 128 of file SessionID.h.

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

std::string FIX::SessionID::m_frozenString
private

Definition at line 133 of file SessionID.h.

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

bool FIX::SessionID::m_isFIXT
private

Definition at line 132 of file SessionID.h.

Referenced by isFIXT(), and SessionID().

SenderCompID FIX::SessionID::m_senderCompID
private

Definition at line 129 of file SessionID.h.

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

std::string FIX::SessionID::m_sessionQualifier
private

Definition at line 131 of file SessionID.h.

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

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:

Generated on Sat Mar 29 2014 15:13:35 for QuickFIX by doxygen 1.8.5 written by Dimitri van Heesch, © 1997-2001