Skip to content

Commit 67f228d

Browse files
author
soranat.thiarachow
committed
ESDK-1601 Updated the interface and implementation of the ChannelInformation class for reference manual and synchronizing interface between EMAJ and EMAC. Restore the original version of EMAC 100__MarketPrice__Streaming example.
1 parent 42217c9 commit 67f228d

File tree

6 files changed

+165
-63
lines changed

6 files changed

+165
-63
lines changed

Cpp-C/Ema/Examples/Training/Consumer/100_Series/100__MarketPrice__Streaming/Consumer.cpp

Lines changed: 3 additions & 12 deletions
Original file line numberDiff line numberDiff line change
@@ -6,7 +6,6 @@
66
///*|-----------------------------------------------------------------------------
77

88
#include "Consumer.h"
9-
#include <stdlib.h>
109

1110
using namespace thomsonreuters::ema::access;
1211
using namespace std;
@@ -18,28 +17,20 @@ void AppClient::onRefreshMsg( const RefreshMsg& refreshMsg, const OmmConsumerEve
1817

1918
void AppClient::onUpdateMsg( const UpdateMsg& updateMsg, const OmmConsumerEvent& )
2019
{
21-
static int i(0);
22-
cout << "updateMsg " << ++i << " for " << updateMsg.getName() << endl;
23-
// cout << updateMsg << endl; // defaults to updateMsg.toString()
24-
if (i == 20)
25-
exit(1);
20+
cout << updateMsg << endl; // defaults to updateMsg.toString()
2621
}
2722

2823
void AppClient::onStatusMsg( const StatusMsg& statusMsg, const OmmConsumerEvent& )
2924
{
3025
cout << statusMsg << endl; // defaults to statusMsg.toString()
3126
}
3227

33-
int main()
28+
int main( int argc, char* argv[] )
3429
{
3530
try {
3631
AppClient client;
37-
OmmConsumer consumer( OmmConsumerConfig("EmaConfig.xml").username( "user" ) );
32+
OmmConsumer consumer( OmmConsumerConfig().host( "localhost:14002" ).username( "user" ) );
3833
consumer.registerClient( ReqMsg().serviceName( "DIRECT_FEED" ).name( "IBM.N" ), client );
39-
UInt64 h(consumer.registerClient( ReqMsg().serviceName( "DIRECT_FEED" ).name( "GOOG.N" ), client ));
40-
sleep( 2000 );
41-
consumer.unregister(h);
42-
cout << "called unregister" << endl;
4334
sleep( 60000 ); // API calls onRefreshMsg(), onUpdateMsg(), or onStatusMsg()
4435
} catch ( const OmmException& excp ) {
4536
cout << excp << endl;

Cpp-C/Ema/Src/Access/CMakeLists.txt

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -41,7 +41,7 @@ else()
4141
Impl/ActiveConfig.cpp Impl/ActiveConfig.h
4242
# Impl/C....
4343
Impl/ChannelCallbackClient.cpp Impl/ChannelCallbackClient.h
44-
Impl/ChannelInformation.cpp
44+
Impl/ChannelInformation.cpp
4545
Impl/ClientSession.cpp Impl/ClientSession.h
4646
Impl/ComplexType.cpp Impl/ConfigErrorHandling.h
4747
# Impl/D....
@@ -208,6 +208,7 @@ else()
208208
# Include/
209209
Include/AckMsg.h
210210
Include/Attrib.h
211+
Include/ChannelInformation.h
211212
Include/Common.h
212213
Include/ComplexType.h
213214
Include/Data.h

Cpp-C/Ema/Src/Access/Impl/ChannelInformation.cpp

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -41,7 +41,7 @@ const EmaString& ChannelInformation::toString() const {
4141
}
4242
_toString.append( "\n\tconnection type: " );
4343
switch( _connectionType ) {
44-
case InitEnum: _toString.append( "not connected" ); break;
44+
case ConnectionType::Unidentified: _toString.append("unknown"); break;
4545
case SocketEnum: _toString.append( "socket" ); break;
4646
case EncryptedEnum: _toString.append( "encrypted" ); break;
4747
case HttpEnum: _toString.append( "http" ); break;
@@ -72,7 +72,7 @@ ChannelInformation::operator const char*() const
7272

7373
void ChannelInformation::clear() {
7474
_channelState = UnknownChannelStateEnum;
75-
_connectionType = InitEnum;
75+
_connectionType = ConnectionType::Unidentified;
7676
_hostname.clear();
7777
_ipAddress.clear();
7878
_connectedComponentInfo.clear();

Cpp-C/Ema/Src/Access/Include/ChannelInformation.h

Lines changed: 15 additions & 15 deletions
Original file line numberDiff line numberDiff line change
@@ -57,7 +57,7 @@ class EMA_ACCESS_API ChannelInformation
5757
*/
5858
enum ConnectionType
5959
{
60-
InitEnum = -1, /*!< (-1) Channel is not connected */
60+
Unidentified = -1, /*!< (-1) Unidentified */
6161
SocketEnum = 0, /*!< (0) Channel is a standard TCP socket connection type */
6262
EncryptedEnum = 1, /*!< (1) Channel is encrypted */
6363
HttpEnum = 2, /*!< (2) Channel is an HTTP connection based tunneling type */
@@ -124,55 +124,55 @@ class EMA_ACCESS_API ChannelInformation
124124
*/
125125
void clear();
126126

127-
/** returns the connected component info as a string
127+
/** Gets the connected component info as a string
128128
@return string representation of this object's connected component info
129129
*/
130130
const EmaString& getConnectedComponentInfo() const { return _connectedComponentInfo; }
131131

132-
/** returns the hostname as a string
132+
/** Gets the hostname as a string
133133
@return string representation of this object's hostname
134134
\remark see discussion of this class at the top of this file for more information
135135
*/
136136
const EmaString& getHostname() const { return _hostname; }
137137

138-
/** returns the IP address as a string
138+
/** Gets the IP address of the connected client
139139
@return string representation of this object's IP address
140140
\remark see discussion of this class at the top of this file for more information.
141141
\remark this is set only for IProvider applications
142142
*/
143143
const EmaString& getIPaddress() const { return _ipAddress; }
144144

145-
/** returns the channel state as a ChannelState enum
145+
/** Gets the channel state as a ChannelState enum
146146
@return ChannelState enum representation of this object's channel state
147147
*/
148148
ChannelState getChannelState() const { return _channelState; }
149149

150-
/** returns the connection type as a ConnectionType enum
150+
/** Gets the connection type as a ConnectionType enum
151151
@return ConnectionType enum representation of this object's connection type
152152
*/
153153
ConnectionType getConnectionType() const { return _connectionType; }
154154

155-
/** returns the protocol type as a ProtocolType enum
155+
/** Gets the protocol type as a ProtocolType enum
156156
@return ProtocolType enum representation of this object's protocol type
157157
*/
158158
ProtocolType getProtocolType() const { return _protocolType; }
159159

160-
/** returns the major version as a UInt32
160+
/** Gets the major version
161161
@return UInt32 representation of this object's major version
162162
*/
163163
UInt32 getMajorVersion() const { return _majorVersion; }
164164

165-
/** returns the minor version as a UInt32
165+
/** Gets the minor version
166166
@return UInt32 representation of this object's minor version
167167
*/
168168
UInt32 getMinorVersion() const { return _minorVersion; }
169169

170-
/** returns the ping timeout as a UInt32
170+
/** Gets the ping timeout
171171
@return UInt32 representation of this object's ping timeout
172172
*/
173173
UInt32 getPingTimeout() const { return _pingTimeout; }
174174

175-
/** Returns a string representation of the class instance.
175+
/** Gets a string representation of the class instance.
176176
@return string representation of the class instance.
177177
*/
178178
const EmaString& toString() const;
@@ -193,7 +193,7 @@ class EMA_ACCESS_API ChannelInformation
193193
*/
194194
ChannelInformation& hostname(const EmaString& hostname);
195195

196-
/** Specifies IP address
196+
/** Specifies the IP address of the connected client
197197
@param[in] ipAddress specifies IP address as a string
198198
@return reference to this object
199199
*/
@@ -224,19 +224,19 @@ class EMA_ACCESS_API ChannelInformation
224224
ChannelInformation& protocolType(ProtocolType protocolType);
225225

226226
/** Specifies major version
227-
@param[in] majorVersion specifies majorVersion as a UInt32
227+
@param[in] majorVersion specifies majorVersion
228228
@return reference to this object
229229
*/
230230
ChannelInformation& majorVersion(UInt32 majorVersion);
231231

232232
/** Specifies minor version
233-
@param[in] minorVersion specifies minorVersion as a UInt32
233+
@param[in] minorVersion specifies minorVersion
234234
@return reference to this object
235235
*/
236236
ChannelInformation& minorVersion(UInt32 minorVersion);
237237

238238
/** Specifies ping timeout
239-
@param[in] pingTimeout specifies ping timeout as a UInt32
239+
@param[in] pingTimeout specifies ping timeout
240240
@return reference to this object
241241
*/
242242
ChannelInformation& pingTimeout(UInt32 pingTimeout);

0 commit comments

Comments
 (0)