OnixS C++ SGX Titan OUCH Trading Handler  1.2.0
API documentation
Handler.cpp
Go to the documentation of this file.
1 /*
2 * Copyright Onix Solutions Limited [OnixS]. All rights reserved.
3 *
4 * This software owned by Onix Solutions Limited [OnixS] and is protected by copyright law
5 * and international copyright treaties.
6 *
7 * Access to and use of the software is governed by the terms of the applicable ONIXS Software
8 * Services Agreement (the Agreement) and Customer end user license agreements granting
9 * a non-assignable, non-transferable and non-exclusive license to use the software
10 * for it's own data processing purposes under the terms defined in the Agreement.
11 *
12 * Except as otherwise granted within the terms of the Agreement, copying or reproduction of any part
13 * of this source code or associated reference material to any other location for further reproduction
14 * or redistribution, and any amendments to this copyright notice, are expressly prohibited.
15 *
16 * Any reproduction or redistribution for sale or hiring of the Software not in accordance with
17 * the terms of the Agreement is a violation of copyright law.
18 */
20 
21 
22 #include "ListenerHolder.h"
23 #include "HandlerImpl.h"
24 #include "Version.h"
25 
26 using namespace OnixS::SgxTitan::Trading::Ouch;
27 
29  : impl_(new Impl(settings))
30 {
31 }
32 
34 {
35  delete impl_;
36 }
37 
38 void Handler::connect(const LogonSettings& logonSettings,
39  const std::string& hostName,
40  UInt16 port,
41  const std::string& localNetworkInterface)
42 {
43  impl_->connect(logonSettings, hostName, port, localNetworkInterface);
44 }
45 
47 {
48  impl_->disconnect();
49 }
50 
52 {
53  impl_->disconnectAsync();
54 }
55 
56 void Handler::send(const OutgoingMessage& message)
57 {
58  return impl_->send(message);
59 }
60 
62 {
63  return impl_->nextExpectedSequenceNumber();
64 }
65 
67 {
68  impl_->listenerHolder()->set(listener);
69 }
70 
72 {
73  impl_->listenerHolder()->set(listener);
74 }
75 
77 {
78  impl_->listenerHolder()->set(listener);
79 }
80 
82 {
83  impl_->listenerHolder()->set(listener);
84 }
85 
87 {
88  impl_->listenerHolder()->set(listener);
89 }
90 
92 {
93  return impl_->getState();
94 }
95 
96 std::string Handler::sessionId() const
97 {
98  return impl_->sessionId();
99 }
100 
101 /*
102  Logging
103 */
104 
105 void Handler::log(OnixS::SgxTitan::Trading::Ouch::LogLevel::Enum logLevel, const char * logMessage, size_t length)
106 {
107  impl_->commonLog(int(logLevel), logMessage, length);
108 }
109 
110 void Handler::log(OnixS::SgxTitan::Trading::Ouch::LogLevel::Enum logLevel, const char * logMessage)
111 {
112  impl_->commonLog(int(logLevel), logMessage, strlen(logMessage));
113 }
114 
115 void Handler::log(OnixS::SgxTitan::Trading::Ouch::LogLevel::Enum logLevel, const std::string& str)
116 {
117  impl_->commonLog(int(logLevel), str.c_str(), str.length());
118 }
119 
120 /*
121  Information requests
122 */
123 
124 const std::string& Handler::licenseExpirationDate() const
125 {
126  return impl_->licenseExpirationDate();
127 }
128 
129 const std::string Handler::version()
130 {
132 }
void connect(const LogonSettings &logonSettings, const std::string &hostName, UInt16 port, const std::string &localNetworkInterface)
HandlerState::Enum state() const
Definition: Handler.cpp:91
void registerMessageListener(MessageListener *listener)
Definition: Handler.cpp:86
void registerSessionListener(SessionListener *listener)
Definition: Handler.cpp:81
void connect(const LogonSettings &logonSettings, const std::string &hostName, UInt16 port, const std::string &localNetworkInterface="")
Definition: Handler.cpp:38
void send(const OutgoingMessage &message, bool warmupMode=false)
std::string sessionId() const
session id
Definition: Handler.cpp:96
Incoming (CFE to TPH) message listener.
void registerWarningListener(WarningListener *listener)
Definition: Handler.cpp:71
Handler(const HandlerSettings &settings)
Definition: Handler.cpp:28
Enum
Defines the state that the handler is in.
void registerErrorListener(ErrorListener *listener)
Definition: Handler.cpp:66
static const std::string version()
Definition: Handler.cpp:129
void commonLog(int logLevel, const char *msg, size_t length)
const std::string & licenseExpirationDate() const
Definition: Handler.cpp:124
void send(const OutgoingMessage &)
Definition: Handler.cpp:56
void registerHandlerStateListener(HandlerStateListener *listener)
Definition: Handler.cpp:76
UInt64 nextExpectedSequenceNumber() const
The next Sequenced Message number to be sent by the exchange.
Definition: Handler.cpp:61
void log(LogLevel::Enum logLevel, const char *logMessage, size_t length)
Definition: Handler.cpp:105