quickfix_ruby_ud 2.0.7
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- checksums.yaml +7 -0
- data/ext/quickfix/Acceptor.cpp +257 -0
- data/ext/quickfix/Acceptor.h +127 -0
- data/ext/quickfix/Allocator.h +9 -0
- data/ext/quickfix/Application.h +137 -0
- data/ext/quickfix/DOMDocument.h +70 -0
- data/ext/quickfix/DataDictionary.cpp +679 -0
- data/ext/quickfix/DataDictionary.h +607 -0
- data/ext/quickfix/DataDictionaryProvider.cpp +66 -0
- data/ext/quickfix/DataDictionaryProvider.h +67 -0
- data/ext/quickfix/DatabaseConnectionID.h +98 -0
- data/ext/quickfix/DatabaseConnectionPool.h +84 -0
- data/ext/quickfix/Dictionary.cpp +157 -0
- data/ext/quickfix/Dictionary.h +89 -0
- data/ext/quickfix/Event.h +89 -0
- data/ext/quickfix/Except.h +39 -0
- data/ext/quickfix/Exceptions.h +257 -0
- data/ext/quickfix/Field.h +654 -0
- data/ext/quickfix/FieldConvertors.cpp +86 -0
- data/ext/quickfix/FieldConvertors.h +800 -0
- data/ext/quickfix/FieldMap.cpp +254 -0
- data/ext/quickfix/FieldMap.h +327 -0
- data/ext/quickfix/FieldNumbers.h +44 -0
- data/ext/quickfix/FieldTypes.cpp +62 -0
- data/ext/quickfix/FieldTypes.h +817 -0
- data/ext/quickfix/Fields.h +30 -0
- data/ext/quickfix/FileLog.cpp +176 -0
- data/ext/quickfix/FileLog.h +110 -0
- data/ext/quickfix/FileStore.cpp +369 -0
- data/ext/quickfix/FileStore.h +131 -0
- data/ext/quickfix/FixCommonFields.h +13 -0
- data/ext/quickfix/FixFieldNumbers.h +6132 -0
- data/ext/quickfix/FixFields.h +6133 -0
- data/ext/quickfix/FixValues.h +5790 -0
- data/ext/quickfix/Group.cpp +44 -0
- data/ext/quickfix/Group.h +78 -0
- data/ext/quickfix/HostDetailsProvider.cpp +79 -0
- data/ext/quickfix/HostDetailsProvider.h +44 -0
- data/ext/quickfix/HtmlBuilder.h +178 -0
- data/ext/quickfix/HttpConnection.cpp +914 -0
- data/ext/quickfix/HttpConnection.h +74 -0
- data/ext/quickfix/HttpMessage.cpp +229 -0
- data/ext/quickfix/HttpMessage.h +112 -0
- data/ext/quickfix/HttpParser.cpp +49 -0
- data/ext/quickfix/HttpParser.h +49 -0
- data/ext/quickfix/HttpServer.cpp +152 -0
- data/ext/quickfix/HttpServer.h +76 -0
- data/ext/quickfix/Initiator.cpp +310 -0
- data/ext/quickfix/Initiator.h +151 -0
- data/ext/quickfix/Log.cpp +71 -0
- data/ext/quickfix/Log.h +254 -0
- data/ext/quickfix/Message.cpp +617 -0
- data/ext/quickfix/Message.h +419 -0
- data/ext/quickfix/MessageCracker.h +171 -0
- data/ext/quickfix/MessageSorters.cpp +101 -0
- data/ext/quickfix/MessageSorters.h +185 -0
- data/ext/quickfix/MessageStore.cpp +182 -0
- data/ext/quickfix/MessageStore.h +164 -0
- data/ext/quickfix/Mutex.h +120 -0
- data/ext/quickfix/MySQLConnection.h +187 -0
- data/ext/quickfix/MySQLLog.cpp +262 -0
- data/ext/quickfix/MySQLLog.h +158 -0
- data/ext/quickfix/MySQLStore.cpp +323 -0
- data/ext/quickfix/MySQLStore.h +161 -0
- data/ext/quickfix/MySQLStubs.h +203 -0
- data/ext/quickfix/NullStore.cpp +40 -0
- data/ext/quickfix/NullStore.h +89 -0
- data/ext/quickfix/OdbcConnection.h +241 -0
- data/ext/quickfix/OdbcLog.cpp +230 -0
- data/ext/quickfix/OdbcLog.h +109 -0
- data/ext/quickfix/OdbcStore.cpp +313 -0
- data/ext/quickfix/OdbcStore.h +124 -0
- data/ext/quickfix/PUGIXML_DOMDocument.cpp +112 -0
- data/ext/quickfix/PUGIXML_DOMDocument.h +81 -0
- data/ext/quickfix/Parser.cpp +111 -0
- data/ext/quickfix/Parser.h +50 -0
- data/ext/quickfix/PostgreSQLConnection.h +163 -0
- data/ext/quickfix/PostgreSQLLog.cpp +263 -0
- data/ext/quickfix/PostgreSQLLog.h +157 -0
- data/ext/quickfix/PostgreSQLStore.cpp +327 -0
- data/ext/quickfix/PostgreSQLStore.h +160 -0
- data/ext/quickfix/PostgreSQLStubs.h +203 -0
- data/ext/quickfix/Queue.h +66 -0
- data/ext/quickfix/QuickfixRuby.cpp +131900 -0
- data/ext/quickfix/QuickfixRuby.h +56 -0
- data/ext/quickfix/Responder.h +41 -0
- data/ext/quickfix/SSLSocketAcceptor.cpp +409 -0
- data/ext/quickfix/SSLSocketAcceptor.h +186 -0
- data/ext/quickfix/SSLSocketConnection.cpp +434 -0
- data/ext/quickfix/SSLSocketConnection.h +221 -0
- data/ext/quickfix/SSLSocketInitiator.cpp +558 -0
- data/ext/quickfix/SSLSocketInitiator.h +203 -0
- data/ext/quickfix/SSLStubs.h +129 -0
- data/ext/quickfix/Session.cpp +1437 -0
- data/ext/quickfix/Session.h +343 -0
- data/ext/quickfix/SessionFactory.cpp +314 -0
- data/ext/quickfix/SessionFactory.h +84 -0
- data/ext/quickfix/SessionID.h +136 -0
- data/ext/quickfix/SessionSettings.cpp +165 -0
- data/ext/quickfix/SessionSettings.h +283 -0
- data/ext/quickfix/SessionState.h +260 -0
- data/ext/quickfix/Settings.cpp +160 -0
- data/ext/quickfix/Settings.h +56 -0
- data/ext/quickfix/SharedArray.h +274 -0
- data/ext/quickfix/SocketAcceptor.cpp +216 -0
- data/ext/quickfix/SocketAcceptor.h +77 -0
- data/ext/quickfix/SocketConnection.cpp +256 -0
- data/ext/quickfix/SocketConnection.h +102 -0
- data/ext/quickfix/SocketConnector.cpp +112 -0
- data/ext/quickfix/SocketConnector.h +76 -0
- data/ext/quickfix/SocketInitiator.cpp +241 -0
- data/ext/quickfix/SocketInitiator.h +76 -0
- data/ext/quickfix/SocketMonitor.h +26 -0
- data/ext/quickfix/SocketMonitor_UNIX.cpp +238 -0
- data/ext/quickfix/SocketMonitor_UNIX.h +101 -0
- data/ext/quickfix/SocketMonitor_WIN32.cpp +248 -0
- data/ext/quickfix/SocketMonitor_WIN32.h +99 -0
- data/ext/quickfix/SocketServer.cpp +163 -0
- data/ext/quickfix/SocketServer.h +100 -0
- data/ext/quickfix/ThreadedSSLSocketAcceptor.cpp +436 -0
- data/ext/quickfix/ThreadedSSLSocketAcceptor.h +209 -0
- data/ext/quickfix/ThreadedSSLSocketConnection.cpp +364 -0
- data/ext/quickfix/ThreadedSSLSocketConnection.h +191 -0
- data/ext/quickfix/ThreadedSSLSocketInitiator.cpp +434 -0
- data/ext/quickfix/ThreadedSSLSocketInitiator.h +193 -0
- data/ext/quickfix/ThreadedSocketAcceptor.cpp +242 -0
- data/ext/quickfix/ThreadedSocketAcceptor.h +95 -0
- data/ext/quickfix/ThreadedSocketConnection.cpp +227 -0
- data/ext/quickfix/ThreadedSocketConnection.h +89 -0
- data/ext/quickfix/ThreadedSocketInitiator.cpp +238 -0
- data/ext/quickfix/ThreadedSocketInitiator.h +78 -0
- data/ext/quickfix/TimeRange.cpp +227 -0
- data/ext/quickfix/TimeRange.h +215 -0
- data/ext/quickfix/Utility.cpp +639 -0
- data/ext/quickfix/Utility.h +255 -0
- data/ext/quickfix/UtilitySSL.cpp +1612 -0
- data/ext/quickfix/UtilitySSL.h +274 -0
- data/ext/quickfix/Values.h +63 -0
- data/ext/quickfix/config-all.h +10 -0
- data/ext/quickfix/config.h +10 -0
- data/ext/quickfix/config_unix.h +178 -0
- data/ext/quickfix/config_windows.h +0 -0
- data/ext/quickfix/dirent_windows.h +838 -0
- data/ext/quickfix/double-conversion/bignum-dtoa.cc +641 -0
- data/ext/quickfix/double-conversion/bignum-dtoa.h +84 -0
- data/ext/quickfix/double-conversion/bignum.cc +766 -0
- data/ext/quickfix/double-conversion/bignum.h +144 -0
- data/ext/quickfix/double-conversion/cached-powers.cc +176 -0
- data/ext/quickfix/double-conversion/cached-powers.h +64 -0
- data/ext/quickfix/double-conversion/diy-fp.cc +57 -0
- data/ext/quickfix/double-conversion/diy-fp.h +118 -0
- data/ext/quickfix/double-conversion/double-conversion.cc +994 -0
- data/ext/quickfix/double-conversion/double-conversion.h +543 -0
- data/ext/quickfix/double-conversion/fast-dtoa.cc +665 -0
- data/ext/quickfix/double-conversion/fast-dtoa.h +88 -0
- data/ext/quickfix/double-conversion/fixed-dtoa.cc +404 -0
- data/ext/quickfix/double-conversion/fixed-dtoa.h +56 -0
- data/ext/quickfix/double-conversion/ieee.h +402 -0
- data/ext/quickfix/double-conversion/strtod.cc +557 -0
- data/ext/quickfix/double-conversion/strtod.h +45 -0
- data/ext/quickfix/double-conversion/utils.h +374 -0
- data/ext/quickfix/extconf.rb +76 -0
- data/ext/quickfix/index.h +37 -0
- data/ext/quickfix/pugiconfig.hpp +77 -0
- data/ext/quickfix/pugixml.cpp +13237 -0
- data/ext/quickfix/pugixml.hpp +1516 -0
- data/ext/quickfix/scope_guard.hpp +215 -0
- data/ext/quickfix/stdint_msvc.h +254 -0
- data/ext/quickfix/strptime.h +7 -0
- data/lib/quickfix40.rb +274 -0
- data/lib/quickfix41.rb +351 -0
- data/lib/quickfix42.rb +1184 -0
- data/lib/quickfix43.rb +3504 -0
- data/lib/quickfix44.rb +14040 -0
- data/lib/quickfix50.rb +20051 -0
- data/lib/quickfix50sp1.rb +23596 -0
- data/lib/quickfix50sp2.rb +412444 -0
- data/lib/quickfix_fields.rb +79393 -0
- data/lib/quickfix_ruby.rb +82 -0
- data/lib/quickfixt11.rb +65 -0
- data/spec/FIX40.xml +862 -0
- data/spec/FIX41.xml +1282 -0
- data/spec/FIX42.xml +2743 -0
- data/spec/FIX43.xml +4230 -0
- data/spec/FIX44.xml +6600 -0
- data/spec/FIX50.xml +8142 -0
- data/spec/FIX50SP1.xml +9506 -0
- data/spec/FIX50SP2.xml +26069 -0
- data/spec/FIXT11.xml +252 -0
- data/test/DataDictionaryTestCase.rb +268 -0
- data/test/DictionaryTestCase.rb +112 -0
- data/test/FieldBaseTestCase.rb +24 -0
- data/test/MessageStoreTestCase.rb +19 -0
- data/test/MessageTestCase.rb +368 -0
- data/test/SessionSettingsTestCase.rb +41 -0
- metadata +236 -0
@@ -0,0 +1,67 @@
|
|
1
|
+
/* -*- C++ -*- */
|
2
|
+
|
3
|
+
/****************************************************************************
|
4
|
+
** Copyright (c) 2001-2014
|
5
|
+
**
|
6
|
+
** This file is part of the QuickFIX FIX Engine
|
7
|
+
**
|
8
|
+
** This file may be distributed under the terms of the quickfixengine.org
|
9
|
+
** license as defined by quickfixengine.org and appearing in the file
|
10
|
+
** LICENSE included in the packaging of this file.
|
11
|
+
**
|
12
|
+
** This file is provided AS IS with NO WARRANTY OF ANY KIND, INCLUDING THE
|
13
|
+
** WARRANTY OF DESIGN, MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE.
|
14
|
+
**
|
15
|
+
** See http://www.quickfixengine.org/LICENSE for licensing information.
|
16
|
+
**
|
17
|
+
** Contact ask@quickfixengine.org if any conditions of this licensing are
|
18
|
+
** not clear to you.
|
19
|
+
**
|
20
|
+
****************************************************************************/
|
21
|
+
|
22
|
+
#ifndef FIX_DATADICTIONARYPROVIDER_H
|
23
|
+
#define FIX_DATADICTIONARYPROVIDER_H
|
24
|
+
|
25
|
+
#ifdef _MSC_VER
|
26
|
+
#pragma warning(disable : 4503 4355 4786 4290)
|
27
|
+
#endif
|
28
|
+
|
29
|
+
#include "DataDictionary.h"
|
30
|
+
#include "Exceptions.h"
|
31
|
+
#include "Utility.h"
|
32
|
+
|
33
|
+
namespace FIX {
|
34
|
+
class BeginString;
|
35
|
+
class ApplVerID;
|
36
|
+
|
37
|
+
/**
|
38
|
+
* Queries for DataDictionary based on appropriate version of %FIX.
|
39
|
+
*/
|
40
|
+
|
41
|
+
class DataDictionaryProvider {
|
42
|
+
public:
|
43
|
+
DataDictionaryProvider() {}
|
44
|
+
DataDictionaryProvider(const DataDictionaryProvider ©);
|
45
|
+
|
46
|
+
const DataDictionary &getSessionDataDictionary(const BeginString &beginString) const EXCEPT(DataDictionaryNotFound);
|
47
|
+
|
48
|
+
const DataDictionary &getApplicationDataDictionary(const ApplVerID &applVerID) const EXCEPT(DataDictionaryNotFound);
|
49
|
+
|
50
|
+
void addTransportDataDictionary(const BeginString &beginString, std::shared_ptr<DataDictionary>);
|
51
|
+
void addApplicationDataDictionary(const ApplVerID &applVerID, std::shared_ptr<DataDictionary>);
|
52
|
+
|
53
|
+
void addTransportDataDictionary(const BeginString &beginString, const std::string &path) {
|
54
|
+
addTransportDataDictionary(beginString, std::shared_ptr<DataDictionary>(new DataDictionary(path)));
|
55
|
+
}
|
56
|
+
void addApplicationDataDictionary(const ApplVerID &applVerID, const std::string &path) {
|
57
|
+
addApplicationDataDictionary(applVerID, std::shared_ptr<DataDictionary>(new DataDictionary(path)));
|
58
|
+
}
|
59
|
+
|
60
|
+
private:
|
61
|
+
std::map<std::string, std::shared_ptr<DataDictionary>> m_transportDictionaries;
|
62
|
+
std::map<std::string, std::shared_ptr<DataDictionary>> m_applicationDictionaries;
|
63
|
+
DataDictionary emptyDataDictionary;
|
64
|
+
};
|
65
|
+
} // namespace FIX
|
66
|
+
|
67
|
+
#endif // FIX_DATADICTIONARYPROVIDER_H
|
@@ -0,0 +1,98 @@
|
|
1
|
+
/* -*- C++ -*- */
|
2
|
+
|
3
|
+
/****************************************************************************
|
4
|
+
** Copyright (c) 2001-2014
|
5
|
+
**
|
6
|
+
** This file is part of the QuickFIX FIX Engine
|
7
|
+
**
|
8
|
+
** This file may be distributed under the terms of the quickfixengine.org
|
9
|
+
** license as defined by quickfixengine.org and appearing in the file
|
10
|
+
** LICENSE included in the packaging of this file.
|
11
|
+
**
|
12
|
+
** This file is provided AS IS with NO WARRANTY OF ANY KIND, INCLUDING THE
|
13
|
+
** WARRANTY OF DESIGN, MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE.
|
14
|
+
**
|
15
|
+
** See http://www.quickfixengine.org/LICENSE for licensing information.
|
16
|
+
**
|
17
|
+
** Contact ask@quickfixengine.org if any conditions of this licensing are
|
18
|
+
** not clear to you.
|
19
|
+
**
|
20
|
+
****************************************************************************/
|
21
|
+
|
22
|
+
#ifndef FIX_DATABASECONNECTIONID_H
|
23
|
+
#define FIX_DATABASECONNECTIONID_H
|
24
|
+
|
25
|
+
#ifdef _MSC_VER
|
26
|
+
#pragma warning(disable : 4503 4355 4786 4290)
|
27
|
+
#endif
|
28
|
+
|
29
|
+
#include <map>
|
30
|
+
#include <string>
|
31
|
+
|
32
|
+
namespace FIX {
|
33
|
+
class DatabaseConnectionID {
|
34
|
+
public:
|
35
|
+
DatabaseConnectionID(
|
36
|
+
const std::string &database,
|
37
|
+
const std::string &user,
|
38
|
+
const std::string &password,
|
39
|
+
const std::string &host,
|
40
|
+
short port)
|
41
|
+
: m_database(database),
|
42
|
+
m_user(user),
|
43
|
+
m_password(password),
|
44
|
+
m_host(host),
|
45
|
+
m_port(port) {}
|
46
|
+
|
47
|
+
friend bool operator<(const DatabaseConnectionID &, const DatabaseConnectionID &);
|
48
|
+
friend bool operator==(const DatabaseConnectionID &, const DatabaseConnectionID &);
|
49
|
+
friend bool operator!=(const DatabaseConnectionID &, const DatabaseConnectionID &);
|
50
|
+
|
51
|
+
const std::string &getDatabase() const { return m_database; }
|
52
|
+
const std::string &getUser() const { return m_user; }
|
53
|
+
const std::string &getPassword() const { return m_password; }
|
54
|
+
const std::string &getHost() const { return m_host; }
|
55
|
+
short getPort() const { return m_port; }
|
56
|
+
|
57
|
+
private:
|
58
|
+
std::string m_database;
|
59
|
+
std::string m_user;
|
60
|
+
std::string m_password;
|
61
|
+
std::string m_host;
|
62
|
+
short m_port;
|
63
|
+
};
|
64
|
+
|
65
|
+
inline bool operator<(const DatabaseConnectionID &lhs, const DatabaseConnectionID &rhs) {
|
66
|
+
if (lhs.m_database < rhs.m_database) {
|
67
|
+
return true;
|
68
|
+
} else if (rhs.m_database < lhs.m_database) {
|
69
|
+
return false;
|
70
|
+
} else if (lhs.m_user < rhs.m_user) {
|
71
|
+
return true;
|
72
|
+
} else if (rhs.m_user < lhs.m_user) {
|
73
|
+
return false;
|
74
|
+
} else if (lhs.m_password < rhs.m_password) {
|
75
|
+
return true;
|
76
|
+
} else if (rhs.m_password < lhs.m_password) {
|
77
|
+
return false;
|
78
|
+
} else if (lhs.m_host < rhs.m_host) {
|
79
|
+
return true;
|
80
|
+
} else if (rhs.m_host < lhs.m_host) {
|
81
|
+
return false;
|
82
|
+
} else if (lhs.m_port < rhs.m_port) {
|
83
|
+
return true;
|
84
|
+
} else if (rhs.m_port < lhs.m_port) {
|
85
|
+
return false;
|
86
|
+
} else {
|
87
|
+
return false;
|
88
|
+
}
|
89
|
+
}
|
90
|
+
inline bool operator==(const DatabaseConnectionID &lhs, const DatabaseConnectionID &rhs) {
|
91
|
+
return (
|
92
|
+
(lhs.m_database == rhs.m_database) && (lhs.m_user == rhs.m_user) && (lhs.m_password == rhs.m_password)
|
93
|
+
&& (lhs.m_host == rhs.m_host) && (lhs.m_port == rhs.m_port));
|
94
|
+
}
|
95
|
+
inline bool operator!=(const DatabaseConnectionID &lhs, const DatabaseConnectionID &rhs) { return !(lhs == rhs); }
|
96
|
+
} // namespace FIX
|
97
|
+
|
98
|
+
#endif
|
@@ -0,0 +1,84 @@
|
|
1
|
+
/* -*- C++ -*- */
|
2
|
+
|
3
|
+
/****************************************************************************
|
4
|
+
** Copyright (c) 2001-2014
|
5
|
+
**
|
6
|
+
** This file is part of the QuickFIX FIX Engine
|
7
|
+
**
|
8
|
+
** This file may be distributed under the terms of the quickfixengine.org
|
9
|
+
** license as defined by quickfixengine.org and appearing in the file
|
10
|
+
** LICENSE included in the packaging of this file.
|
11
|
+
**
|
12
|
+
** This file is provided AS IS with NO WARRANTY OF ANY KIND, INCLUDING THE
|
13
|
+
** WARRANTY OF DESIGN, MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE.
|
14
|
+
**
|
15
|
+
** See http://www.quickfixengine.org/LICENSE for licensing information.
|
16
|
+
**
|
17
|
+
** Contact ask@quickfixengine.org if any conditions of this licensing are
|
18
|
+
** not clear to you.
|
19
|
+
**
|
20
|
+
****************************************************************************/
|
21
|
+
|
22
|
+
#ifndef FIX_DATABASECONNECTIONPOOL_H
|
23
|
+
#define FIX_DATABASECONNECTIONPOOL_H
|
24
|
+
|
25
|
+
#ifdef _MSC_VER
|
26
|
+
#pragma warning(disable : 4503 4355 4786 4290)
|
27
|
+
#endif
|
28
|
+
|
29
|
+
#include "DatabaseConnectionID.h"
|
30
|
+
#include <map>
|
31
|
+
#include <string>
|
32
|
+
|
33
|
+
namespace FIX {
|
34
|
+
template <typename T> class DatabaseConnectionPool {
|
35
|
+
public:
|
36
|
+
DatabaseConnectionPool(bool poolConnections)
|
37
|
+
: m_poolConnections(poolConnections) {}
|
38
|
+
|
39
|
+
T *create(const DatabaseConnectionID &id) {
|
40
|
+
if (!m_poolConnections) {
|
41
|
+
return new T(id);
|
42
|
+
}
|
43
|
+
|
44
|
+
if (m_connections.find(id) == m_connections.end()) {
|
45
|
+
m_connections[id] = Connection(new T(id), 0);
|
46
|
+
}
|
47
|
+
m_connections[id].second++;
|
48
|
+
return m_connections[id].first;
|
49
|
+
}
|
50
|
+
|
51
|
+
bool destroy(T *pConnection) {
|
52
|
+
if (!m_poolConnections) {
|
53
|
+
delete pConnection;
|
54
|
+
return true;
|
55
|
+
}
|
56
|
+
|
57
|
+
const DatabaseConnectionID &id = pConnection->connectionID();
|
58
|
+
if (m_connections.find(id) == m_connections.end()) {
|
59
|
+
return false;
|
60
|
+
}
|
61
|
+
|
62
|
+
Connection &connection = m_connections[id];
|
63
|
+
if (connection.first != pConnection) {
|
64
|
+
return false;
|
65
|
+
}
|
66
|
+
|
67
|
+
connection.second--;
|
68
|
+
if (connection.second == 0) {
|
69
|
+
m_connections.erase(id);
|
70
|
+
delete pConnection;
|
71
|
+
}
|
72
|
+
return true;
|
73
|
+
}
|
74
|
+
|
75
|
+
private:
|
76
|
+
typedef std::pair<T *, int> Connection;
|
77
|
+
typedef std::map<DatabaseConnectionID, Connection> Connections;
|
78
|
+
|
79
|
+
Connections m_connections;
|
80
|
+
bool m_poolConnections;
|
81
|
+
};
|
82
|
+
} // namespace FIX
|
83
|
+
|
84
|
+
#endif
|
@@ -0,0 +1,157 @@
|
|
1
|
+
/****************************************************************************
|
2
|
+
** Copyright (c) 2001-2014
|
3
|
+
**
|
4
|
+
** This file is part of the QuickFIX FIX Engine
|
5
|
+
**
|
6
|
+
** This file may be distributed under the terms of the quickfixengine.org
|
7
|
+
** license as defined by quickfixengine.org and appearing in the file
|
8
|
+
** LICENSE included in the packaging of this file.
|
9
|
+
**
|
10
|
+
** This file is provided AS IS with NO WARRANTY OF ANY KIND, INCLUDING THE
|
11
|
+
** WARRANTY OF DESIGN, MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE.
|
12
|
+
**
|
13
|
+
** See http://www.quickfixengine.org/LICENSE for licensing information.
|
14
|
+
**
|
15
|
+
** Contact ask@quickfixengine.org if any conditions of this licensing are
|
16
|
+
** not clear to you.
|
17
|
+
**
|
18
|
+
****************************************************************************/
|
19
|
+
|
20
|
+
#ifdef _MSC_VER
|
21
|
+
#include "stdafx.h"
|
22
|
+
#else
|
23
|
+
#include "config.h"
|
24
|
+
#endif
|
25
|
+
|
26
|
+
#include "Dictionary.h"
|
27
|
+
#include "FieldConvertors.h"
|
28
|
+
#include <algorithm>
|
29
|
+
|
30
|
+
namespace FIX {
|
31
|
+
std::string Dictionary::getString(const std::string &key, bool capitalize) const
|
32
|
+
EXCEPT(ConfigError, FieldConvertError) {
|
33
|
+
Data::const_iterator i = m_data.find(string_toUpper(key));
|
34
|
+
if (i == m_data.end()) {
|
35
|
+
throw ConfigError(key + " not defined");
|
36
|
+
}
|
37
|
+
|
38
|
+
std::string result = i->second;
|
39
|
+
if (capitalize) {
|
40
|
+
std::transform(result.begin(), result.end(), result.begin(), toupper);
|
41
|
+
}
|
42
|
+
|
43
|
+
return result;
|
44
|
+
}
|
45
|
+
|
46
|
+
int Dictionary::getInt(const std::string &key) const EXCEPT(ConfigError, FieldConvertError) {
|
47
|
+
try {
|
48
|
+
return IntConvertor::convert(getString(key));
|
49
|
+
} catch (FieldConvertError &) {
|
50
|
+
throw ConfigError("Illegal value " + getString(key) + " for " + key);
|
51
|
+
}
|
52
|
+
}
|
53
|
+
|
54
|
+
double Dictionary::getDouble(const std::string &key) const EXCEPT(ConfigError, FieldConvertError) {
|
55
|
+
try {
|
56
|
+
return DoubleConvertor::convert(getString(key));
|
57
|
+
} catch (FieldConvertError &) {
|
58
|
+
throw ConfigError("Illegal value " + getString(key) + " for " + key);
|
59
|
+
}
|
60
|
+
}
|
61
|
+
|
62
|
+
bool Dictionary::getBool(const std::string &key) const EXCEPT(ConfigError, FieldConvertError) {
|
63
|
+
try {
|
64
|
+
return BoolConvertor::convert(getString(key));
|
65
|
+
} catch (FieldConvertError &) {
|
66
|
+
throw ConfigError("Illegal value " + getString(key) + " for " + key);
|
67
|
+
}
|
68
|
+
}
|
69
|
+
|
70
|
+
int Dictionary::getDay(const std::string &key) const EXCEPT(ConfigError, FieldConvertError) {
|
71
|
+
try {
|
72
|
+
std::string value = getString(key);
|
73
|
+
if (value.size() < 2) {
|
74
|
+
throw FieldConvertError();
|
75
|
+
}
|
76
|
+
std::string abbr = value.substr(0, 2);
|
77
|
+
std::transform(abbr.begin(), abbr.end(), abbr.begin(), tolower);
|
78
|
+
if (abbr == "su") {
|
79
|
+
return 1;
|
80
|
+
}
|
81
|
+
if (abbr == "mo") {
|
82
|
+
return 2;
|
83
|
+
}
|
84
|
+
if (abbr == "tu") {
|
85
|
+
return 3;
|
86
|
+
}
|
87
|
+
if (abbr == "we") {
|
88
|
+
return 4;
|
89
|
+
}
|
90
|
+
if (abbr == "th") {
|
91
|
+
return 5;
|
92
|
+
}
|
93
|
+
if (abbr == "fr") {
|
94
|
+
return 6;
|
95
|
+
}
|
96
|
+
if (abbr == "sa") {
|
97
|
+
return 7;
|
98
|
+
}
|
99
|
+
} catch (FieldConvertError &) {
|
100
|
+
throw ConfigError("Illegal value " + getString(key) + " for " + key);
|
101
|
+
}
|
102
|
+
return -1;
|
103
|
+
}
|
104
|
+
|
105
|
+
void Dictionary::setString(const std::string &key, const std::string &value) {
|
106
|
+
m_data[string_strip(string_toUpper(key))] = string_strip(value);
|
107
|
+
}
|
108
|
+
|
109
|
+
void Dictionary::setInt(const std::string &key, int value) {
|
110
|
+
m_data[string_strip(string_toUpper(key))] = IntConvertor::convert(value);
|
111
|
+
}
|
112
|
+
|
113
|
+
void Dictionary::setDouble(const std::string &key, double value) {
|
114
|
+
m_data[string_strip(string_toUpper(key))] = DoubleConvertor::convert(value);
|
115
|
+
}
|
116
|
+
|
117
|
+
void Dictionary::setBool(const std::string &key, bool value) {
|
118
|
+
m_data[string_strip(string_toUpper(key))] = BoolConvertor::convert(value);
|
119
|
+
}
|
120
|
+
|
121
|
+
void Dictionary::setDay(const std::string &key, int value) {
|
122
|
+
switch (value) {
|
123
|
+
case 1:
|
124
|
+
setString(key, "SU");
|
125
|
+
break;
|
126
|
+
case 2:
|
127
|
+
setString(key, "MO");
|
128
|
+
break;
|
129
|
+
case 3:
|
130
|
+
setString(key, "TU");
|
131
|
+
break;
|
132
|
+
case 4:
|
133
|
+
setString(key, "WE");
|
134
|
+
break;
|
135
|
+
case 5:
|
136
|
+
setString(key, "TH");
|
137
|
+
break;
|
138
|
+
case 6:
|
139
|
+
setString(key, "FR");
|
140
|
+
break;
|
141
|
+
case 7:
|
142
|
+
setString(key, "SA");
|
143
|
+
break;
|
144
|
+
}
|
145
|
+
}
|
146
|
+
|
147
|
+
bool Dictionary::has(const std::string &key) const { return m_data.find(string_toUpper(key)) != m_data.end(); }
|
148
|
+
|
149
|
+
void Dictionary::merge(const Dictionary &toMerge) {
|
150
|
+
Data::const_iterator i = toMerge.m_data.begin();
|
151
|
+
for (; i != toMerge.m_data.end(); ++i) {
|
152
|
+
if (m_data.find(i->first) == m_data.end()) {
|
153
|
+
m_data[i->first] = i->second;
|
154
|
+
}
|
155
|
+
}
|
156
|
+
}
|
157
|
+
} // namespace FIX
|
@@ -0,0 +1,89 @@
|
|
1
|
+
/* -*- C++ -*- */
|
2
|
+
|
3
|
+
/****************************************************************************
|
4
|
+
** Copyright (c) 2001-2014
|
5
|
+
**
|
6
|
+
** This file is part of the QuickFIX FIX Engine
|
7
|
+
**
|
8
|
+
** This file may be distributed under the terms of the quickfixengine.org
|
9
|
+
** license as defined by quickfixengine.org and appearing in the file
|
10
|
+
** LICENSE included in the packaging of this file.
|
11
|
+
**
|
12
|
+
** This file is provided AS IS with NO WARRANTY OF ANY KIND, INCLUDING THE
|
13
|
+
** WARRANTY OF DESIGN, MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE.
|
14
|
+
**
|
15
|
+
** See http://www.quickfixengine.org/LICENSE for licensing information.
|
16
|
+
**
|
17
|
+
** Contact ask@quickfixengine.org if any conditions of this licensing are
|
18
|
+
** not clear to you.
|
19
|
+
**
|
20
|
+
****************************************************************************/
|
21
|
+
|
22
|
+
#ifndef FIX_DICTIONARY_H
|
23
|
+
#define FIX_DICTIONARY_H
|
24
|
+
|
25
|
+
#ifdef _MSC_VER
|
26
|
+
#pragma warning(disable : 4503 4355 4786 4290)
|
27
|
+
#endif
|
28
|
+
|
29
|
+
#include "Exceptions.h"
|
30
|
+
#include <map>
|
31
|
+
#include <string>
|
32
|
+
|
33
|
+
namespace FIX {
|
34
|
+
/// For storage and retrieval of key/value pairs.
|
35
|
+
class Dictionary {
|
36
|
+
public:
|
37
|
+
Dictionary(const std::string &name)
|
38
|
+
: m_name(name) {}
|
39
|
+
Dictionary() {}
|
40
|
+
virtual ~Dictionary() {}
|
41
|
+
|
42
|
+
typedef std::map<std::string, std::string> Data;
|
43
|
+
typedef Data::const_iterator iterator;
|
44
|
+
typedef iterator const_iterator;
|
45
|
+
typedef Data::value_type value_type;
|
46
|
+
|
47
|
+
/// Get the name of the dictionary.
|
48
|
+
std::string getName() const { return m_name; }
|
49
|
+
/// Return the number of key/value pairs.
|
50
|
+
size_t size() const { return m_data.size(); }
|
51
|
+
|
52
|
+
/// Get a value as a string.
|
53
|
+
std::string getString(const std::string &, bool capitalize = false) const EXCEPT(ConfigError, FieldConvertError);
|
54
|
+
/// Get a value as a int.
|
55
|
+
int getInt(const std::string &) const EXCEPT(ConfigError, FieldConvertError);
|
56
|
+
/// Get a value as a double.
|
57
|
+
double getDouble(const std::string &) const EXCEPT(ConfigError, FieldConvertError);
|
58
|
+
/// Get a value as a bool
|
59
|
+
bool getBool(const std::string &) const EXCEPT(ConfigError, FieldConvertError);
|
60
|
+
/// Get a value as a day of week
|
61
|
+
int getDay(const std::string &) const EXCEPT(ConfigError, FieldConvertError);
|
62
|
+
|
63
|
+
/// Set a value from a string.
|
64
|
+
void setString(const std::string &, const std::string &);
|
65
|
+
/// Set a value from a int.
|
66
|
+
void setInt(const std::string &, int);
|
67
|
+
/// Set a value from a double.
|
68
|
+
void setDouble(const std::string &, double);
|
69
|
+
/// Set a value from a bool
|
70
|
+
void setBool(const std::string &, bool);
|
71
|
+
/// Set a value from a day
|
72
|
+
void setDay(const std::string &, int);
|
73
|
+
|
74
|
+
/// Check if the dictionary contains a value for key.
|
75
|
+
bool has(const std::string &) const;
|
76
|
+
/// Merge two dictionaries.
|
77
|
+
void merge(const Dictionary &);
|
78
|
+
|
79
|
+
iterator begin() const { return m_data.begin(); }
|
80
|
+
iterator end() const { return m_data.end(); }
|
81
|
+
|
82
|
+
private:
|
83
|
+
Data m_data;
|
84
|
+
std::string m_name;
|
85
|
+
};
|
86
|
+
/*! @} */
|
87
|
+
} // namespace FIX
|
88
|
+
|
89
|
+
#endif // FIX_DICTIONARY_H
|
@@ -0,0 +1,89 @@
|
|
1
|
+
/* -*- C++ -*- */
|
2
|
+
|
3
|
+
/****************************************************************************
|
4
|
+
** Copyright (c) 2001-2014
|
5
|
+
**
|
6
|
+
** This file is part of the QuickFIX FIX Engine
|
7
|
+
**
|
8
|
+
** This file may be distributed under the terms of the quickfixengine.org
|
9
|
+
** license as defined by quickfixengine.org and appearing in the file
|
10
|
+
** LICENSE included in the packaging of this file.
|
11
|
+
**
|
12
|
+
** This file is provided AS IS with NO WARRANTY OF ANY KIND, INCLUDING THE
|
13
|
+
** WARRANTY OF DESIGN, MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE.
|
14
|
+
**
|
15
|
+
** See http://www.quickfixengine.org/LICENSE for licensing information.
|
16
|
+
**
|
17
|
+
** Contact ask@quickfixengine.org if any conditions of this licensing are
|
18
|
+
** not clear to you.
|
19
|
+
**
|
20
|
+
****************************************************************************/
|
21
|
+
|
22
|
+
#ifndef FIX_EVENT_H
|
23
|
+
#define FIX_EVENT_H
|
24
|
+
|
25
|
+
#include "Utility.h"
|
26
|
+
#include <math.h>
|
27
|
+
|
28
|
+
#ifndef _MSC_VER
|
29
|
+
#include <cmath>
|
30
|
+
#include <pthread.h>
|
31
|
+
#endif
|
32
|
+
|
33
|
+
namespace FIX {
|
34
|
+
/// Portable implementation of an event/conditional mutex
|
35
|
+
class Event {
|
36
|
+
public:
|
37
|
+
Event() {
|
38
|
+
#ifdef _MSC_VER
|
39
|
+
m_event = CreateEvent(0, false, false, 0);
|
40
|
+
#else
|
41
|
+
pthread_mutex_init(&m_mutex, 0);
|
42
|
+
pthread_cond_init(&m_event, 0);
|
43
|
+
#endif
|
44
|
+
}
|
45
|
+
|
46
|
+
~Event() {
|
47
|
+
#ifdef _MSC_VER
|
48
|
+
CloseHandle(m_event);
|
49
|
+
#else
|
50
|
+
pthread_cond_destroy(&m_event);
|
51
|
+
pthread_mutex_destroy(&m_mutex);
|
52
|
+
#endif
|
53
|
+
}
|
54
|
+
|
55
|
+
void signal() {
|
56
|
+
#ifdef _MSC_VER
|
57
|
+
SetEvent(m_event);
|
58
|
+
#else
|
59
|
+
pthread_mutex_lock(&m_mutex);
|
60
|
+
pthread_cond_broadcast(&m_event);
|
61
|
+
pthread_mutex_unlock(&m_mutex);
|
62
|
+
#endif
|
63
|
+
}
|
64
|
+
|
65
|
+
void wait(double s) {
|
66
|
+
#ifdef _MSC_VER
|
67
|
+
WaitForSingleObject(m_event, (long)(s * 1000));
|
68
|
+
#else
|
69
|
+
pthread_mutex_lock(&m_mutex);
|
70
|
+
timespec time, remainder;
|
71
|
+
double intpart;
|
72
|
+
time.tv_nsec = (long)(modf(s, &intpart) * 1e9);
|
73
|
+
time.tv_sec = (int)intpart;
|
74
|
+
pthread_cond_timedwait(&m_event, &m_mutex, &time);
|
75
|
+
pthread_mutex_unlock(&m_mutex);
|
76
|
+
#endif
|
77
|
+
}
|
78
|
+
|
79
|
+
private:
|
80
|
+
#ifdef _MSC_VER
|
81
|
+
HANDLE m_event;
|
82
|
+
#else
|
83
|
+
pthread_cond_t m_event;
|
84
|
+
pthread_mutex_t m_mutex;
|
85
|
+
#endif
|
86
|
+
};
|
87
|
+
} // namespace FIX
|
88
|
+
|
89
|
+
#endif
|
@@ -0,0 +1,39 @@
|
|
1
|
+
/* -*- C++ -*- */
|
2
|
+
|
3
|
+
/****************************************************************************
|
4
|
+
** Copyright (c) 2001-2014
|
5
|
+
**
|
6
|
+
** This file is part of the QuickFIX FIX Engine
|
7
|
+
**
|
8
|
+
** This file may be distributed under the terms of the quickfixengine.org
|
9
|
+
** license as defined by quickfixengine.org and appearing in the file
|
10
|
+
** LICENSE included in the packaging of this file.
|
11
|
+
**
|
12
|
+
** This file is provided AS IS with NO WARRANTY OF ANY KIND, INCLUDING THE
|
13
|
+
** WARRANTY OF DESIGN, MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE.
|
14
|
+
**
|
15
|
+
** See http://www.quickfixengine.org/LICENSE for licensing information.
|
16
|
+
**
|
17
|
+
** Contact ask@quickfixengine.org if any conditions of this licensing are
|
18
|
+
** not clear to you.
|
19
|
+
**
|
20
|
+
****************************************************************************/
|
21
|
+
|
22
|
+
#ifndef FIX_EXCEPT_H
|
23
|
+
#define FIX_EXCEPT_H
|
24
|
+
|
25
|
+
#if !defined(__cpp_noexcept_function_type) && defined(__cplusplus)
|
26
|
+
#if __cplusplus > 201703L
|
27
|
+
#define __cpp_noexcept_function_type 1
|
28
|
+
#endif
|
29
|
+
#endif
|
30
|
+
|
31
|
+
#ifdef __cpp_noexcept_function_type
|
32
|
+
#define NOEXCEPT noexcept
|
33
|
+
#define EXCEPT(...)
|
34
|
+
#else
|
35
|
+
#define NOEXCEPT throw()
|
36
|
+
#define EXCEPT(...) throw(__VA_ARGS__)
|
37
|
+
#endif
|
38
|
+
|
39
|
+
#endif
|