quickfix_ruby 1.14.3

Sign up to get free protection for your applications and to get access to all the features.
Files changed (149) hide show
  1. checksums.yaml +7 -0
  2. data/ext/quickfix/Acceptor.cpp +248 -0
  3. data/ext/quickfix/Acceptor.h +127 -0
  4. data/ext/quickfix/Allocator.h +9 -0
  5. data/ext/quickfix/Application.h +127 -0
  6. data/ext/quickfix/AtomicCount.h +109 -0
  7. data/ext/quickfix/DOMDocument.h +74 -0
  8. data/ext/quickfix/DataDictionary.cpp +618 -0
  9. data/ext/quickfix/DataDictionary.h +539 -0
  10. data/ext/quickfix/DataDictionaryProvider.cpp +71 -0
  11. data/ext/quickfix/DataDictionaryProvider.h +70 -0
  12. data/ext/quickfix/DatabaseConnectionID.h +105 -0
  13. data/ext/quickfix/DatabaseConnectionPool.h +91 -0
  14. data/ext/quickfix/Dictionary.cpp +162 -0
  15. data/ext/quickfix/Dictionary.h +94 -0
  16. data/ext/quickfix/Event.h +95 -0
  17. data/ext/quickfix/Exceptions.h +299 -0
  18. data/ext/quickfix/Field.h +672 -0
  19. data/ext/quickfix/FieldConvertors.h +863 -0
  20. data/ext/quickfix/FieldMap.cpp +238 -0
  21. data/ext/quickfix/FieldMap.h +244 -0
  22. data/ext/quickfix/FieldNumbers.h +46 -0
  23. data/ext/quickfix/FieldTypes.cpp +64 -0
  24. data/ext/quickfix/FieldTypes.h +698 -0
  25. data/ext/quickfix/Fields.h +31 -0
  26. data/ext/quickfix/FileLog.cpp +200 -0
  27. data/ext/quickfix/FileLog.h +112 -0
  28. data/ext/quickfix/FileStore.cpp +332 -0
  29. data/ext/quickfix/FileStore.h +129 -0
  30. data/ext/quickfix/FixFieldNumbers.h +1537 -0
  31. data/ext/quickfix/FixFields.h +1538 -0
  32. data/ext/quickfix/FixValues.h +3281 -0
  33. data/ext/quickfix/FlexLexer.h +188 -0
  34. data/ext/quickfix/Group.cpp +64 -0
  35. data/ext/quickfix/Group.h +73 -0
  36. data/ext/quickfix/HtmlBuilder.h +186 -0
  37. data/ext/quickfix/HttpConnection.cpp +739 -0
  38. data/ext/quickfix/HttpConnection.h +78 -0
  39. data/ext/quickfix/HttpMessage.cpp +149 -0
  40. data/ext/quickfix/HttpMessage.h +133 -0
  41. data/ext/quickfix/HttpParser.cpp +49 -0
  42. data/ext/quickfix/HttpParser.h +54 -0
  43. data/ext/quickfix/HttpServer.cpp +169 -0
  44. data/ext/quickfix/HttpServer.h +78 -0
  45. data/ext/quickfix/Initiator.cpp +289 -0
  46. data/ext/quickfix/Initiator.h +149 -0
  47. data/ext/quickfix/Log.cpp +77 -0
  48. data/ext/quickfix/Log.h +179 -0
  49. data/ext/quickfix/Message.cpp +580 -0
  50. data/ext/quickfix/Message.h +370 -0
  51. data/ext/quickfix/MessageCracker.h +188 -0
  52. data/ext/quickfix/MessageSorters.cpp +105 -0
  53. data/ext/quickfix/MessageSorters.h +156 -0
  54. data/ext/quickfix/MessageStore.cpp +146 -0
  55. data/ext/quickfix/MessageStore.h +174 -0
  56. data/ext/quickfix/Mutex.h +131 -0
  57. data/ext/quickfix/MySQLConnection.h +194 -0
  58. data/ext/quickfix/MySQLLog.cpp +275 -0
  59. data/ext/quickfix/MySQLLog.h +145 -0
  60. data/ext/quickfix/MySQLStore.cpp +331 -0
  61. data/ext/quickfix/MySQLStore.h +142 -0
  62. data/ext/quickfix/NullStore.cpp +54 -0
  63. data/ext/quickfix/NullStore.h +99 -0
  64. data/ext/quickfix/OdbcConnection.h +266 -0
  65. data/ext/quickfix/OdbcLog.cpp +252 -0
  66. data/ext/quickfix/OdbcLog.h +117 -0
  67. data/ext/quickfix/OdbcStore.cpp +338 -0
  68. data/ext/quickfix/OdbcStore.h +113 -0
  69. data/ext/quickfix/PUGIXML_DOMDocument.cpp +112 -0
  70. data/ext/quickfix/PUGIXML_DOMDocument.h +81 -0
  71. data/ext/quickfix/Parser.cpp +103 -0
  72. data/ext/quickfix/Parser.h +57 -0
  73. data/ext/quickfix/PostgreSQLConnection.h +176 -0
  74. data/ext/quickfix/PostgreSQLLog.cpp +276 -0
  75. data/ext/quickfix/PostgreSQLLog.h +144 -0
  76. data/ext/quickfix/PostgreSQLStore.cpp +334 -0
  77. data/ext/quickfix/PostgreSQLStore.h +141 -0
  78. data/ext/quickfix/Queue.h +75 -0
  79. data/ext/quickfix/QuickfixRuby.cpp +252066 -0
  80. data/ext/quickfix/QuickfixRuby.h +34 -0
  81. data/ext/quickfix/Responder.h +43 -0
  82. data/ext/quickfix/Session.cpp +1487 -0
  83. data/ext/quickfix/Session.h +335 -0
  84. data/ext/quickfix/SessionFactory.cpp +274 -0
  85. data/ext/quickfix/SessionFactory.h +86 -0
  86. data/ext/quickfix/SessionID.h +170 -0
  87. data/ext/quickfix/SessionSettings.cpp +189 -0
  88. data/ext/quickfix/SessionSettings.h +171 -0
  89. data/ext/quickfix/SessionState.h +231 -0
  90. data/ext/quickfix/Settings.cpp +100 -0
  91. data/ext/quickfix/Settings.h +53 -0
  92. data/ext/quickfix/SharedArray.h +150 -0
  93. data/ext/quickfix/SocketAcceptor.cpp +222 -0
  94. data/ext/quickfix/SocketAcceptor.h +75 -0
  95. data/ext/quickfix/SocketConnection.cpp +238 -0
  96. data/ext/quickfix/SocketConnection.h +103 -0
  97. data/ext/quickfix/SocketConnector.cpp +116 -0
  98. data/ext/quickfix/SocketConnector.h +67 -0
  99. data/ext/quickfix/SocketInitiator.cpp +260 -0
  100. data/ext/quickfix/SocketInitiator.h +81 -0
  101. data/ext/quickfix/SocketMonitor.cpp +335 -0
  102. data/ext/quickfix/SocketMonitor.h +111 -0
  103. data/ext/quickfix/SocketServer.cpp +177 -0
  104. data/ext/quickfix/SocketServer.h +100 -0
  105. data/ext/quickfix/ThreadedSocketAcceptor.cpp +258 -0
  106. data/ext/quickfix/ThreadedSocketAcceptor.h +98 -0
  107. data/ext/quickfix/ThreadedSocketConnection.cpp +209 -0
  108. data/ext/quickfix/ThreadedSocketConnection.h +82 -0
  109. data/ext/quickfix/ThreadedSocketInitiator.cpp +268 -0
  110. data/ext/quickfix/ThreadedSocketInitiator.h +84 -0
  111. data/ext/quickfix/TimeRange.cpp +173 -0
  112. data/ext/quickfix/TimeRange.h +258 -0
  113. data/ext/quickfix/Utility.cpp +537 -0
  114. data/ext/quickfix/Utility.h +219 -0
  115. data/ext/quickfix/Values.h +62 -0
  116. data/ext/quickfix/config.h +0 -0
  117. data/ext/quickfix/config_windows.h +0 -0
  118. data/ext/quickfix/extconf.rb +12 -0
  119. data/ext/quickfix/index.h +37 -0
  120. data/ext/quickfix/pugiconfig.hpp +72 -0
  121. data/ext/quickfix/pugixml.cpp +10765 -0
  122. data/ext/quickfix/pugixml.hpp +1341 -0
  123. data/ext/quickfix/strptime.h +7 -0
  124. data/lib/quickfix40.rb +274 -0
  125. data/lib/quickfix41.rb +351 -0
  126. data/lib/quickfix42.rb +1184 -0
  127. data/lib/quickfix43.rb +3504 -0
  128. data/lib/quickfix44.rb +10721 -0
  129. data/lib/quickfix50.rb +13426 -0
  130. data/lib/quickfix50sp1.rb +15629 -0
  131. data/lib/quickfix50sp2.rb +17068 -0
  132. data/lib/quickfix_fields.rb +19853 -0
  133. data/lib/quickfix_ruby.rb +82 -0
  134. data/lib/quickfixt11.rb +70 -0
  135. data/spec/FIX40.xml +862 -0
  136. data/spec/FIX41.xml +1285 -0
  137. data/spec/FIX42.xml +2746 -0
  138. data/spec/FIX43.xml +4229 -0
  139. data/spec/FIX44.xml +6596 -0
  140. data/spec/FIX50.xml +8137 -0
  141. data/spec/FIX50SP1.xml +9496 -0
  142. data/spec/FIX50SP2.xml +10011 -0
  143. data/spec/FIXT11.xml +313 -0
  144. data/test/test_DataDictionaryTestCase.rb +268 -0
  145. data/test/test_DictionaryTestCase.rb +112 -0
  146. data/test/test_FieldBaseTestCase.rb +24 -0
  147. data/test/test_MessageTestCase.rb +368 -0
  148. data/test/test_SessionSettingsTestCase.rb +41 -0
  149. metadata +193 -0
@@ -0,0 +1,105 @@
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 <string>
30
+ #include <map>
31
+
32
+ namespace FIX
33
+ {
34
+ class DatabaseConnectionID
35
+ {
36
+ public:
37
+ DatabaseConnectionID
38
+ ( const std::string& database, const std::string& user,
39
+ const std::string& password, const std::string& host, short port )
40
+ : m_database( database ), m_user( user ), m_password( password ),
41
+ m_host( host ), m_port( port ) {}
42
+
43
+ friend bool operator<( const DatabaseConnectionID&, const DatabaseConnectionID& );
44
+ friend bool operator==( const DatabaseConnectionID&, const DatabaseConnectionID& );
45
+ friend bool operator!=( const DatabaseConnectionID&, const DatabaseConnectionID& );
46
+
47
+ const std::string& getDatabase() const
48
+ { return m_database; }
49
+ const std::string& getUser() const
50
+ { return m_user; }
51
+ const std::string& getPassword() const
52
+ { return m_password; }
53
+ const std::string& getHost() const
54
+ { return m_host; }
55
+ short getPort() const
56
+ { return m_port; }
57
+
58
+ private:
59
+ std::string m_database;
60
+ std::string m_user;
61
+ std::string m_password;
62
+ std::string m_host;
63
+ short m_port;
64
+ };
65
+
66
+ inline bool operator<( const DatabaseConnectionID& lhs, const DatabaseConnectionID& rhs )
67
+ {
68
+ if ( lhs.m_database < rhs.m_database )
69
+ return true;
70
+ else if ( rhs.m_database < lhs.m_database )
71
+ return false;
72
+ else if ( lhs.m_user < rhs.m_user )
73
+ return true;
74
+ else if ( rhs.m_user < lhs.m_user )
75
+ return false;
76
+ else if ( lhs.m_password < rhs.m_password )
77
+ return true;
78
+ else if ( rhs.m_password < lhs.m_password )
79
+ return false;
80
+ else if ( lhs.m_host < rhs.m_host )
81
+ return true;
82
+ else if ( rhs.m_host < lhs.m_host )
83
+ return false;
84
+ else if ( lhs.m_port < rhs.m_port )
85
+ return true;
86
+ else if ( rhs.m_port < lhs.m_port )
87
+ return false;
88
+ else
89
+ return false;
90
+ }
91
+ inline bool operator==( const DatabaseConnectionID& lhs, const DatabaseConnectionID& rhs )
92
+ {
93
+ return ( ( lhs.m_database == rhs.m_database ) &&
94
+ ( lhs.m_user == rhs.m_user ) &&
95
+ ( lhs.m_password == rhs.m_password ) &&
96
+ ( lhs.m_host == rhs.m_host ) &&
97
+ ( lhs.m_port == rhs.m_port ));
98
+ }
99
+ inline bool operator!=( const DatabaseConnectionID& lhs, const DatabaseConnectionID& rhs )
100
+ {
101
+ return !( lhs == rhs );
102
+ }
103
+ }
104
+
105
+ #endif
@@ -0,0 +1,91 @@
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 <string>
31
+ #include <map>
32
+
33
+ namespace FIX
34
+ {
35
+ template< typename T > class DatabaseConnectionPool
36
+ {
37
+ public:
38
+ DatabaseConnectionPool( bool poolConnections )
39
+ : m_poolConnections( poolConnections ) {}
40
+
41
+ T* create( const DatabaseConnectionID& id )
42
+ {
43
+ if( !m_poolConnections )
44
+ return new T( id );
45
+
46
+ if( m_connections.find( id ) == m_connections.end() )
47
+ {
48
+ m_connections[id] = Connection
49
+ ( new T(id), 0 );
50
+ }
51
+ m_connections[id].second++;
52
+ return m_connections[id].first;
53
+ }
54
+
55
+ bool destroy( T* pConnection )
56
+ {
57
+ if( !m_poolConnections )
58
+ {
59
+ delete pConnection;
60
+ return true;
61
+ }
62
+
63
+ const DatabaseConnectionID& id = pConnection->connectionID();
64
+ if( m_connections.find( id ) == m_connections.end() )
65
+ return false;
66
+
67
+ Connection& connection = m_connections[id];
68
+ if( connection.first != pConnection )
69
+ return false;
70
+
71
+ connection.second--;
72
+ if( connection.second == 0 )
73
+ {
74
+ m_connections.erase( id );
75
+ delete pConnection;
76
+ }
77
+ return true;
78
+ }
79
+
80
+ private:
81
+ typedef std::pair<T*, int>
82
+ Connection;
83
+ typedef std::map<DatabaseConnectionID, Connection>
84
+ Connections;
85
+
86
+ Connections m_connections;
87
+ bool m_poolConnections;
88
+ };
89
+ }
90
+
91
+ #endif
@@ -0,0 +1,162 @@
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
+ {
32
+ std::string Dictionary::getString( const std::string& key, bool capitalize ) const
33
+ throw( ConfigError, FieldConvertError )
34
+ {
35
+ Data::const_iterator i = m_data.find( string_toUpper(key) );
36
+ if ( i == m_data.end() ) throw ConfigError( key + " not defined" );
37
+
38
+ std::string result = i->second;
39
+ if( capitalize )
40
+ std::transform(result.begin(), result.end(), result.begin(), toupper);
41
+
42
+ return result;
43
+ }
44
+
45
+ int Dictionary::getInt( const std::string& key ) const
46
+ throw( ConfigError, FieldConvertError )
47
+ {
48
+ try
49
+ {
50
+ return IntConvertor::convert( getString(key) );
51
+ }
52
+ catch ( FieldConvertError& )
53
+ {
54
+ throw ConfigError( "Illegal value " + getString(key) + " for " + key );
55
+ }
56
+ }
57
+
58
+ double Dictionary::getDouble( const std::string& key ) const
59
+ throw( ConfigError, FieldConvertError )
60
+ {
61
+ try
62
+ {
63
+ return DoubleConvertor::convert( getString(key) );
64
+ }
65
+ catch ( FieldConvertError& )
66
+ {
67
+ throw ConfigError( "Illegal value " + getString(key) + " for " + key );
68
+ }
69
+ }
70
+
71
+ bool Dictionary::getBool( const std::string& key ) const
72
+ throw( ConfigError, FieldConvertError )
73
+ {
74
+ try
75
+ {
76
+ return BoolConvertor::convert( getString(key) );
77
+ }
78
+ catch ( FieldConvertError& )
79
+ {
80
+ throw ConfigError( "Illegal value " + getString(key) + " for " + key );
81
+ }
82
+ }
83
+
84
+ int Dictionary::getDay( const std::string& key ) const
85
+ throw( ConfigError, FieldConvertError )
86
+ {
87
+ try
88
+ {
89
+ std::string value = getString(key);
90
+ if( value.size() < 2 ) throw FieldConvertError(0);
91
+ std::string abbr = value.substr(0, 2);
92
+ std::transform( abbr.begin(), abbr.end(), abbr.begin(), tolower );
93
+ if( abbr == "su" ) return 1;
94
+ if( abbr == "mo" ) return 2;
95
+ if( abbr == "tu" ) return 3;
96
+ if( abbr == "we" ) return 4;
97
+ if( abbr == "th" ) return 5;
98
+ if( abbr == "fr" ) return 6;
99
+ if( abbr == "sa" ) return 7;
100
+ if( value.size() < 2 ) throw FieldConvertError(0);
101
+ }
102
+ catch ( FieldConvertError& )
103
+ {
104
+ throw ConfigError( "Illegal value " + getString(key) + " for " + key );
105
+ }
106
+ return -1;
107
+ }
108
+
109
+ void Dictionary::setString( const std::string& key, const std::string& value )
110
+ {
111
+ m_data[ string_strip(string_toUpper(key)) ] = string_strip(value);
112
+ }
113
+
114
+ void Dictionary::setInt( const std::string& key, int value )
115
+ {
116
+ m_data[ string_strip(string_toUpper(key)) ] = IntConvertor::convert( value );
117
+ }
118
+
119
+ void Dictionary::setDouble( const std::string& key, double value )
120
+ {
121
+ m_data[ string_strip(string_toUpper(key)) ] = DoubleConvertor::convert( value );
122
+ }
123
+
124
+ void Dictionary::setBool( const std::string& key, bool value )
125
+ {
126
+ m_data[ string_strip(string_toUpper(key)) ] = BoolConvertor::convert( value );
127
+ }
128
+
129
+ void Dictionary::setDay( const std::string& key, int value )
130
+ {
131
+ switch( value )
132
+ {
133
+ case 1:
134
+ setString( key, "SU" ); break;
135
+ case 2:
136
+ setString( key, "MO" ); break;
137
+ case 3:
138
+ setString( key, "TU" ); break;
139
+ case 4:
140
+ setString( key, "WE" ); break;
141
+ case 5:
142
+ setString( key, "TH" ); break;
143
+ case 6:
144
+ setString( key, "FR" ); break;
145
+ case 7:
146
+ setString( key, "SA" ); break;
147
+ }
148
+ }
149
+
150
+ bool Dictionary::has( const std::string& key ) const
151
+ {
152
+ return m_data.find( string_toUpper(key) ) != m_data.end();
153
+ }
154
+
155
+ void Dictionary::merge( const Dictionary& toMerge )
156
+ {
157
+ Data::const_iterator i = toMerge.m_data.begin();
158
+ for ( ; i != toMerge.m_data.end(); ++i )
159
+ if ( m_data.find( i->first ) == m_data.end() )
160
+ m_data[ i->first ] = i->second;
161
+ }
162
+ }
@@ -0,0 +1,94 @@
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 <map>
30
+ #include <string>
31
+ #include "Exceptions.h"
32
+
33
+ namespace FIX
34
+ {
35
+ /// For storage and retrieval of key/value pairs.
36
+ class Dictionary
37
+ {
38
+ public:
39
+ Dictionary( const std::string& name ) : m_name( name ) {}
40
+ Dictionary() {}
41
+ virtual ~Dictionary() {}
42
+
43
+ typedef std::map < std::string, std::string > Data;
44
+ typedef Data::const_iterator iterator;
45
+ typedef iterator const_iterator;
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
54
+ throw( ConfigError, FieldConvertError );
55
+ /// Get a value as a int.
56
+ int getInt( const std::string& ) const
57
+ throw( ConfigError, FieldConvertError );
58
+ /// Get a value as a double.
59
+ double getDouble( const std::string& ) const
60
+ throw( ConfigError, FieldConvertError );
61
+ /// Get a value as a bool
62
+ bool getBool( const std::string& ) const
63
+ throw( ConfigError, FieldConvertError );
64
+ /// Get a value as a day of week
65
+ int getDay( const std::string& ) const
66
+ throw( ConfigError, FieldConvertError );
67
+
68
+ /// Set a value from a string.
69
+ void setString( const std::string&, const std::string& );
70
+ /// Set a value from a int.
71
+ void setInt( const std::string&, int );
72
+ /// Set a value from a double.
73
+ void setDouble( const std::string&, double );
74
+ /// Set a value from a bool
75
+ void setBool( const std::string&, bool );
76
+ /// Set a value from a day
77
+ void setDay( const std::string&, int );
78
+
79
+ /// Check if the dictionary contains a value for key.
80
+ bool has( const std::string& ) const;
81
+ /// Merge two dictionaries.
82
+ void merge( const Dictionary& );
83
+
84
+ iterator begin() const { return m_data.begin(); }
85
+ iterator end() const { return m_data.end(); }
86
+
87
+ private:
88
+ Data m_data;
89
+ std::string m_name;
90
+ };
91
+ /*! @} */
92
+ }
93
+
94
+ #endif //FIX_DICTIONARY_H
@@ -0,0 +1,95 @@
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 <pthread.h>
30
+ #include <cmath>
31
+ #endif
32
+
33
+ namespace FIX
34
+ {
35
+ /// Portable implementation of an event/conditional mutex
36
+ class Event
37
+ {
38
+ public:
39
+ Event()
40
+ {
41
+ #ifdef _MSC_VER
42
+ m_event = CreateEvent( 0, false, false, 0 );
43
+ #else
44
+ pthread_mutex_init( &m_mutex, 0 );
45
+ pthread_cond_init( &m_event, 0 );
46
+ #endif
47
+ }
48
+
49
+ ~Event()
50
+ {
51
+ #ifdef _MSC_VER
52
+ CloseHandle( m_event );
53
+ #else
54
+ pthread_cond_destroy( &m_event );
55
+ pthread_mutex_destroy( &m_mutex );
56
+ #endif
57
+ }
58
+
59
+ void signal()
60
+ {
61
+ #ifdef _MSC_VER
62
+ SetEvent( m_event );
63
+ #else
64
+ pthread_mutex_lock( &m_mutex );
65
+ pthread_cond_broadcast( &m_event );
66
+ pthread_mutex_unlock( &m_mutex );
67
+ #endif
68
+ }
69
+
70
+ void wait( double s )
71
+ {
72
+ #ifdef _MSC_VER
73
+ WaitForSingleObject( m_event, (long)(s * 1000) );
74
+ #else
75
+ pthread_mutex_lock( &m_mutex );
76
+ timespec time, remainder;
77
+ double intpart;
78
+ time.tv_nsec = (long)(modf(s, &intpart) * 1e9);
79
+ time.tv_sec = (int)intpart;
80
+ pthread_cond_timedwait( &m_event, &m_mutex, &time );
81
+ pthread_mutex_unlock( &m_mutex );
82
+ #endif
83
+ }
84
+
85
+ private:
86
+ #ifdef _MSC_VER
87
+ HANDLE m_event;
88
+ #else
89
+ pthread_cond_t m_event;
90
+ pthread_mutex_t m_mutex;
91
+ #endif
92
+ };
93
+ }
94
+
95
+ #endif