fix8  version 1.4.0
Open Source C++ FIX Framework
FIX8::SessionID Class Reference

Quickfix style sessionid. More...

#include <session.hpp>

Public Member Functions

 SessionID (const f8String &beginString, const f8String &senderCompID, const f8String &targetCompID)
 
 SessionID (const begin_string &beginString, const sender_comp_id &senderCompID, const target_comp_id &targetCompID)
 
 SessionID (const f8String &from)
 
 SessionID (const SessionID &from)
 
 SessionID ()
 
virtual ~SessionID ()
 Dtor. More...
 
F8API void make_id ()
 
F8API SessionID make_reverse_id () const
 
F8API void from_string (const f8String &from)
 Create a sessionid string. More...
 
const begin_stringget_beginString () const
 
const sender_comp_idget_senderCompID () const
 
const target_comp_idget_targetCompID () const
 
const f8Stringget_id () const
 
bool same_sender_comp_id (const target_comp_id &targetCompID) const
 
bool same_target_comp_id (const sender_comp_id &senderCompID) const
 
bool same_side_target_comp_id (const target_comp_id &targetCompID) const
 
bool same_side_sender_comp_id (const sender_comp_id &senderCompID) const
 
bool operator== (const SessionID &that)
 
bool operator!= (const SessionID &that)
 

Private Attributes

begin_string _beginString
 
sender_comp_id _senderCompID
 
target_comp_id _targetCompID
 
f8String _id
 
f8String _rid
 

Static Private Attributes

static RegExp _sid
 

Friends

std::ostream & operator<< (std::ostream &os, const SessionID &what)
 

Detailed Description

Quickfix style sessionid.

Definition at line 46 of file session.hpp.

Constructor & Destructor Documentation

FIX8::SessionID::SessionID ( const f8String beginString,
const f8String senderCompID,
const f8String targetCompID 
)
inline

Ctor.

Parameters
beginStringFix begin string
senderCompIDFix senderCompID string
targetCompIDFix targetCompID string

Definition at line 61 of file session.hpp.

References make_id().

62  : _beginString(beginString), _senderCompID(senderCompID), _targetCompID(targetCompID) { make_id(); }
target_comp_id _targetCompID
Definition: session.hpp:52
sender_comp_id _senderCompID
Definition: session.hpp:51
F8API void make_id()
Definition: session.cpp:73
begin_string _beginString
Definition: session.hpp:50
FIX8::SessionID::SessionID ( const begin_string beginString,
const sender_comp_id senderCompID,
const target_comp_id targetCompID 
)
inline

Ctor.

Parameters
beginStringFix begin string field
senderCompIDFix senderCompID string field
targetCompIDFix targetCompID string field

Definition at line 68 of file session.hpp.

References make_id().

69  : _beginString(beginString), _senderCompID(senderCompID), _targetCompID(targetCompID) { make_id(); }
target_comp_id _targetCompID
Definition: session.hpp:52
sender_comp_id _senderCompID
Definition: session.hpp:51
F8API void make_id()
Definition: session.cpp:73
begin_string _beginString
Definition: session.hpp:50
FIX8::SessionID::SessionID ( const f8String from)
inline

Ctor.

Parameters
fromSessionID string

Definition at line 73 of file session.hpp.

References from_string().

73 { from_string(from); }
F8API void from_string(const f8String &from)
Create a sessionid string.
Definition: session.cpp:87
FIX8::SessionID::SessionID ( const SessionID from)
inline

Ctor.

Parameters
fromSessionID field

Definition at line 77 of file session.hpp.

77  : _beginString(from._beginString), _senderCompID(from._senderCompID),
78  _targetCompID(from._targetCompID), _id(from._id) {}
target_comp_id _targetCompID
Definition: session.hpp:52
sender_comp_id _senderCompID
Definition: session.hpp:51
f8String _id
Definition: session.hpp:54
begin_string _beginString
Definition: session.hpp:50
FIX8::SessionID::SessionID ( )
inline

Definition at line 80 of file session.hpp.

80 {}
virtual FIX8::SessionID::~SessionID ( )
inlinevirtual

Dtor.

Definition at line 83 of file session.hpp.

83 {}

Member Function Documentation

void SessionID::from_string ( const f8String from)

Create a sessionid string.

Definition at line 87 of file session.cpp.

Referenced by SessionID().

88 {
89  RegMatch match;
90  if (_sid.SearchString(match, from, 4) == 4)
91  {
92  f8String bstr, scid, tcid;
93  _sid.SubExpr(match, from, bstr, 0, 1);
94  _beginString.set(bstr);
95  _sid.SubExpr(match, from, scid, 0, 2);
96  _senderCompID.set(scid);
97  _sid.SubExpr(match, from, tcid, 0, 3);
98  _targetCompID.set(tcid);
99  make_id();
100  }
101 }
target_comp_id _targetCompID
Definition: session.hpp:52
static std::string & SubExpr(RegMatch &match, const std::string &source, std::string &target, const int offset=0, const int num=0)
Definition: f8utils.hpp:452
sender_comp_id _senderCompID
Definition: session.hpp:51
int SearchString(RegMatch &match, const std::string &source, const int subExpr, const int offset=0) const
Definition: f8utils.hpp:431
F8API void make_id()
Definition: session.cpp:73
begin_string _beginString
Definition: session.hpp:50
A class to contain regex matches using RegExp.
Definition: f8utils.hpp:308
static RegExp _sid
Definition: session.hpp:48
std::string f8String
Definition: f8types.hpp:47
const begin_string& FIX8::SessionID::get_beginString ( ) const
inline

Get the beginstring field.

Returns
beginstring

Definition at line 97 of file session.hpp.

References _beginString.

97 { return _beginString; }
begin_string _beginString
Definition: session.hpp:50
const f8String& FIX8::SessionID::get_id ( ) const
inline

Get the target_comp_id field.

Returns
target_comp_id

Definition at line 109 of file session.hpp.

References _id.

109 { return _id; }
f8String _id
Definition: session.hpp:54
const sender_comp_id& FIX8::SessionID::get_senderCompID ( ) const
inline

Get the sender_comp_id field.

Returns
sender_comp_id

Definition at line 101 of file session.hpp.

References _senderCompID.

Referenced by FIX8::Configuration::create_persister(), FIX8::Configuration::get_logname(), FIX8::Session::handle_logon(), and FIX8::Session::send_process().

101 { return _senderCompID; }
sender_comp_id _senderCompID
Definition: session.hpp:51
const target_comp_id& FIX8::SessionID::get_targetCompID ( ) const
inline

Get the target_comp_id field.

Returns
target_comp_id

Definition at line 105 of file session.hpp.

References _targetCompID.

Referenced by FIX8::Configuration::create_persister(), FIX8::Configuration::get_logname(), and FIX8::Session::send_process().

105 { return _targetCompID; }
target_comp_id _targetCompID
Definition: session.hpp:52
void SessionID::make_id ( )

Create a sessionid and reverse sessionid strings.

Definition at line 73 of file session.cpp.

Referenced by SessionID().

74 {
75  ostringstream ostr;
76  ostr << _beginString << ':' << _senderCompID << "->" << _targetCompID;
77  _id = ostr.str();
78 }
target_comp_id _targetCompID
Definition: session.hpp:52
sender_comp_id _senderCompID
Definition: session.hpp:51
f8String _id
Definition: session.hpp:54
begin_string _beginString
Definition: session.hpp:50
SessionID SessionID::make_reverse_id ( ) const

Create a reverse SessionID from the current SessionID

Returns
reverse SessionID

Definition at line 81 of file session.cpp.

82 {
84 }
target_comp_id _targetCompID
Definition: session.hpp:52
sender_comp_id _senderCompID
Definition: session.hpp:51
begin_string _beginString
Definition: session.hpp:50
bool FIX8::SessionID::operator!= ( const SessionID that)
inline

SessionID inequivalence operator

Parameters
thatSessionID to check
Returns
true if SessionIDS are not equal

Definition at line 142 of file session.hpp.

References _senderCompID, and _targetCompID.

143  {
144  return this != &that ? that._senderCompID() != _senderCompID() && that._targetCompID() != _targetCompID() : false;
145  }
target_comp_id _targetCompID
Definition: session.hpp:52
sender_comp_id _senderCompID
Definition: session.hpp:51
bool FIX8::SessionID::operator== ( const SessionID that)
inline

SessionID equivalence operator

Parameters
thatSessionID to check
Returns
true if SessionIDS are equal

Definition at line 134 of file session.hpp.

References _senderCompID, and _targetCompID.

135  {
136  return this != &that ? that._senderCompID() == _senderCompID() && that._targetCompID() == _targetCompID() : true;
137  }
target_comp_id _targetCompID
Definition: session.hpp:52
sender_comp_id _senderCompID
Definition: session.hpp:51
bool FIX8::SessionID::same_sender_comp_id ( const target_comp_id targetCompID) const
inline

Sendercompid equivalence function..

Parameters
targetCompIDcompid to check
Returns
true if both Targetcompids are the same

Definition at line 114 of file session.hpp.

References _senderCompID.

114 { return targetCompID() == _senderCompID(); }
sender_comp_id _senderCompID
Definition: session.hpp:51
bool FIX8::SessionID::same_side_sender_comp_id ( const sender_comp_id senderCompID) const
inline

Targetcompid equivalence function..

Parameters
senderCompIDcompid to check
Returns
true if both Targetcompids are the same, on the same session side

Definition at line 129 of file session.hpp.

References _senderCompID.

129 { return senderCompID() == _senderCompID(); }
sender_comp_id _senderCompID
Definition: session.hpp:51
bool FIX8::SessionID::same_side_target_comp_id ( const target_comp_id targetCompID) const
inline

targetcompid equivalence function..

Parameters
targetCompIDcompid to check
Returns
true if both Sendercompids are the same, on the same session side

Definition at line 124 of file session.hpp.

References _targetCompID.

124 { return targetCompID() == _targetCompID(); }
target_comp_id _targetCompID
Definition: session.hpp:52
bool FIX8::SessionID::same_target_comp_id ( const sender_comp_id senderCompID) const
inline

Sendercompid equivalence function..

Parameters
senderCompIDcompid to check
Returns
true if both Sendercompids are the same

Definition at line 119 of file session.hpp.

References _targetCompID.

119 { return senderCompID() == _targetCompID(); }
target_comp_id _targetCompID
Definition: session.hpp:52

Friends And Related Function Documentation

std::ostream& operator<< ( std::ostream &  os,
const SessionID what 
)
friend

Inserter friend.

Parameters
osstream to send to
whatSessionID
Returns
stream

Definition at line 151 of file session.hpp.

151 { return os << what._id; }

Member Data Documentation

begin_string FIX8::SessionID::_beginString
private

Definition at line 50 of file session.hpp.

Referenced by get_beginString().

f8String FIX8::SessionID::_id
private

Definition at line 54 of file session.hpp.

Referenced by get_id().

f8String FIX8::SessionID::_rid
private

Definition at line 54 of file session.hpp.

sender_comp_id FIX8::SessionID::_senderCompID
private
RegExp SessionID::_sid
staticprivate

Definition at line 48 of file session.hpp.

target_comp_id FIX8::SessionID::_targetCompID
private

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