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,698 @@
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_FIELDTYPES_H
23
+ #define FIX_FIELDTYPES_H
24
+
25
+ #ifdef _MSC_VER
26
+ #pragma warning( disable : 4503 4355 4786 4290 )
27
+ #endif
28
+
29
+ #include "Utility.h"
30
+ #include <string>
31
+ #include <time.h>
32
+
33
+ namespace FIX
34
+ {
35
+ /*! \addtogroup user
36
+ * @{
37
+ */
38
+
39
+ /// Date and Time stored as a Julian day number and number of
40
+ /// milliseconds since midnight. Does not perform any timezone
41
+ /// calculations. All magic numbers and related calculations
42
+ /// have been taken from:
43
+ ///
44
+ /// \sa http://www.faqs.org/faqs/calendars.faq
45
+ /// \sa http://scienceworld.wolfram.com/astronomy/JulianDate.html
46
+ /// \sa http://scienceworld.wolfram.com/astronomy/GregorianCalendar.html
47
+ /// \sa http://scienceworld.wolfram.com/astronomy/Weekday.html
48
+ ///
49
+ /// \author Caleb Epstein <caleb.epstein at gmail dot com>
50
+ struct DateTime
51
+ {
52
+ int m_date;
53
+ int m_time;
54
+
55
+ /// Magic numbers
56
+ enum
57
+ {
58
+ SECONDS_PER_DAY = 86400,
59
+ SECONDS_PER_HOUR = 3600,
60
+ SECONDS_PER_MIN = 60,
61
+ MINUTES_PER_HOUR = 60,
62
+
63
+ MILLIS_PER_DAY = 86400000,
64
+ MILLIS_PER_HOUR = 3600000,
65
+ MILLIS_PER_MIN = 60000,
66
+ MILLIS_PER_SEC = 1000,
67
+
68
+ // time_t epoch (1970-01-01) as a Julian date
69
+ JULIAN_19700101 = 2440588
70
+ };
71
+
72
+ /// Default constructor - initializes to zero
73
+ DateTime () : m_date (0), m_time (0) {}
74
+
75
+ /// Construct from a Julian day number and time in millis
76
+ DateTime (int date, int time) : m_date (date), m_time (time) {}
77
+
78
+ /// Construct from the specified components
79
+ DateTime( int year, int month, int day,
80
+ int hour, int minute, int second, int millis )
81
+ {
82
+ m_date = julianDate( year, month, day );
83
+ m_time = makeHMS( hour, minute, second, millis );
84
+ }
85
+
86
+ virtual ~DateTime() {}
87
+
88
+ /// Return the year portion of the date
89
+ inline int getYear() const
90
+ {
91
+ int y, m, d;
92
+ getYMD( y, m, d );
93
+ return y;
94
+ }
95
+
96
+ /// Return the month (1-12) portion of the date
97
+ inline int getMonth() const
98
+ {
99
+ int y, m, d;
100
+ getYMD( y, m, d );
101
+ return m;
102
+ }
103
+
104
+ /// Return the day of the month portion of the date
105
+ inline int getDay() const
106
+ {
107
+ int y, m, d;
108
+ getYMD( y, m, d );
109
+ return d;
110
+ }
111
+
112
+ /// Another name for the day of the month. Bad name, but used
113
+ /// because of the legacy UtcTimeStamp interface
114
+ inline int getDate() const { return getDay(); }
115
+
116
+ /// Return the internal julian date
117
+ inline int getJulianDate() const { return m_date; }
118
+
119
+ /// Return the hour portion of the time (0-23)
120
+ inline int getHour() const
121
+ {
122
+ return m_time / MILLIS_PER_HOUR;
123
+ }
124
+
125
+ /// Return the minute portion of the time (0-59)
126
+ inline int getMinute() const
127
+ {
128
+ return (m_time / MILLIS_PER_MIN) % MINUTES_PER_HOUR;
129
+ }
130
+
131
+ /// Return the second portion of the time (0-59)
132
+ inline int getSecond() const
133
+ {
134
+ return (m_time / MILLIS_PER_SEC) % SECONDS_PER_MIN;
135
+ }
136
+
137
+ /// Return the millisecond portion of the time
138
+ inline int getMillisecond() const
139
+ {
140
+ return m_time % MILLIS_PER_SEC;
141
+ }
142
+
143
+ /// Load the referenced values with the year, month and day
144
+ /// portions of the date in a single operation
145
+ inline void getYMD (int& year, int& month, int& day) const
146
+ {
147
+ getYMD( m_date, year, month, day );
148
+ }
149
+
150
+ /// Load the referenced values with the hour, minute, second and
151
+ /// millisecond portions of the time in a single operation
152
+ inline void getHMS( int& hour, int& minute, int& second, int& millis ) const
153
+ {
154
+ int ticks = m_time / MILLIS_PER_SEC;
155
+ hour = ticks / SECONDS_PER_HOUR;
156
+ minute = (ticks / SECONDS_PER_MIN) % MINUTES_PER_HOUR;
157
+ second = ticks % SECONDS_PER_MIN;
158
+ millis = m_time % MILLIS_PER_SEC;
159
+ }
160
+
161
+ /// Calculate the weekday of the date (Sunday is 1, Saturday is 7)
162
+ inline int getWeekDay() const
163
+ {
164
+ int Y, M, D;
165
+ getYMD (Y, M, D);
166
+ int m = M >= 3 ? M - 2 : M + 10;
167
+ int Yprime = M >= 3 ? Y : Y - 1;
168
+ int y = Yprime % 100;
169
+ int c = Yprime / 100;
170
+ int wd = (D + int (2.6 * m - 0.2) + y + int (y / 4) + int (c / 4) -
171
+ (2 * c)) % 7;
172
+ return 1 + (wd < 0 ? 7 + wd : wd);
173
+ }
174
+
175
+ /// Convert the DateTime to a time_t. Note that this operation
176
+ /// can overflow on 32-bit platforms when we go beyond year 2038.
177
+ inline time_t getTimeT() const
178
+ {
179
+ return (SECONDS_PER_DAY * (m_date - JULIAN_19700101) +
180
+ m_time / MILLIS_PER_SEC);
181
+ }
182
+
183
+ /// Convert the DateTime to a struct tm which is in UTC
184
+ tm getTmUtc() const
185
+ {
186
+ int year, month, day;
187
+ int hour, minute, second, millis;
188
+ tm result = { 0 };
189
+
190
+ getYMD( year, month, day );
191
+ getHMS( hour, minute, second, millis );
192
+
193
+ result.tm_year = year - 1900;
194
+ result.tm_mon = month - 1;
195
+ result.tm_mday = day;
196
+ result.tm_hour = hour;
197
+ result.tm_min = minute;
198
+ result.tm_sec = second;
199
+ result.tm_isdst = -1;
200
+
201
+ return result;
202
+ }
203
+
204
+ /// Set the date portion of the DateTime
205
+ void setYMD( int year, int month, int day )
206
+ {
207
+ m_date = julianDate( year, month, day );
208
+ }
209
+
210
+ /// Set the time portion of the DateTime
211
+ void setHMS( int hour, int minute, int second, int millis )
212
+ {
213
+ m_time = makeHMS( hour, minute, second, millis );
214
+ }
215
+
216
+ /// Set the hour portion of the time
217
+ void setHour( int hour )
218
+ {
219
+ int old_hour, min, sec, millis;
220
+ getHMS( old_hour, min, sec, millis );
221
+ setHMS( hour, min, sec, millis );
222
+ }
223
+
224
+ /// Set the minute portion of the time
225
+ void setMinute( int min )
226
+ {
227
+ int hour, old_min, sec, millis;
228
+ getHMS( hour, old_min, sec, millis );
229
+ setHMS( hour, min, sec, millis );
230
+ }
231
+
232
+ /// Set the seconds portion of the time
233
+ void setSecond( int sec )
234
+ {
235
+ int hour, min, old_sec, millis;
236
+ getHMS( hour, min, old_sec, millis );
237
+ setHMS( hour, min, sec, millis );
238
+ }
239
+
240
+ /// Set the millisecond portion of the time
241
+ void setMillisecond( int millis )
242
+ {
243
+ int hour, min, sec, old_millis;
244
+ getHMS( hour, min, sec, old_millis );
245
+ setHMS( hour, min, sec, millis );
246
+ }
247
+
248
+ /// Clear the date portion of the DateTime
249
+ void clearDate()
250
+ {
251
+ m_date = 0;
252
+ }
253
+
254
+ /// Clear the time portion of the DateTime
255
+ void clearTime()
256
+ {
257
+ m_time = 0;
258
+ }
259
+
260
+ /// Set the internal date and time members
261
+ void set( int date, int time ) { m_date = date; m_time = time; }
262
+
263
+ /// Initialize from another DateTime
264
+ void set( const DateTime& other )
265
+ {
266
+ m_date = other.m_date;
267
+ m_time = other.m_time;
268
+ }
269
+
270
+ /// Add a number of seconds to this
271
+ void operator+=( int seconds )
272
+ {
273
+ int d = seconds / SECONDS_PER_DAY;
274
+ int s = seconds % SECONDS_PER_DAY;
275
+
276
+ m_date += d;
277
+ m_time += s * MILLIS_PER_SEC;
278
+
279
+ if( m_time > MILLIS_PER_DAY )
280
+ {
281
+ m_date++;
282
+ m_time %= MILLIS_PER_DAY;
283
+ }
284
+ else if( m_time < 0 )
285
+ {
286
+ m_date--;
287
+ m_time += MILLIS_PER_DAY;
288
+ }
289
+ }
290
+
291
+ /// Helper method to convert a broken down time to a number of
292
+ /// milliseconds since midnight
293
+ static int makeHMS( int hour, int minute, int second, int millis )
294
+ {
295
+ return MILLIS_PER_SEC * (SECONDS_PER_HOUR * hour +
296
+ SECONDS_PER_MIN * minute +
297
+ second) + millis;
298
+ }
299
+
300
+ /// Return the current wall-clock time as a utc DateTime
301
+ static DateTime nowUtc();
302
+
303
+ /// Return the current wall-clock time as a local DateTime
304
+ static DateTime nowLocal();
305
+
306
+ /// Convert a time_t and optional milliseconds to a DateTime
307
+ static DateTime fromUtcTimeT( time_t t, int millis = 0 )
308
+ {
309
+ struct tm tm = time_gmtime( &t );
310
+ return fromTm( tm, millis );
311
+ }
312
+
313
+ static DateTime fromLocalTimeT( time_t t, int millis = 0 )
314
+ {
315
+ struct tm tm = time_localtime( &t );
316
+ return fromTm( tm, millis );
317
+ }
318
+
319
+ /// Convert a tm and optional milliseconds to a DateTime. \note
320
+ /// the tm structure is assumed to contain a date specified in UTC
321
+ static DateTime fromTm( const tm& tm, int millis = 0 )
322
+ {
323
+ return DateTime ( julianDate(tm.tm_year + 1900, tm.tm_mon + 1,
324
+ tm.tm_mday),
325
+ makeHMS(tm.tm_hour, tm.tm_min, tm.tm_sec, millis) );
326
+ }
327
+
328
+ /// Helper method to calculate a Julian day number.
329
+ static int julianDate( int year, int month, int day )
330
+ {
331
+ int a = (14 - month) / 12;
332
+ int y = year + 4800 - a;
333
+ int m = month + 12 * a - 3;
334
+ return (day + int ((153 * m + 2) / 5) + y * 365 +
335
+ int (y / 4) - int (y / 100) + int (y / 400) - 32045);
336
+ }
337
+
338
+ /// Convert a Julian day number to a year, month and day
339
+ static void getYMD( int jday, int& year, int& month, int& day )
340
+ {
341
+ int a = jday + 32044;
342
+ int b = (4 * a + 3) / 146097;
343
+ int c = a - int ((b * 146097) / 4);
344
+ int d = (4 * c + 3) / 1461;
345
+ int e = c - int ((1461 * d) / 4);
346
+ int m = (5 * e + 2) / 153;
347
+ day = e - int ((153 * m + 2) / 5) + 1;
348
+ month = m + 3 - 12 * int (m / 10);
349
+ year = b * 100 + d - 4800 + int (m / 10);
350
+ }
351
+ };
352
+
353
+ inline bool operator==( const DateTime& lhs, const DateTime& rhs )
354
+ {
355
+ return lhs.m_date == rhs.m_date && lhs.m_time == rhs.m_time;
356
+ }
357
+
358
+ inline bool operator!=( const DateTime& lhs, const DateTime& rhs )
359
+ {
360
+ return !(lhs == rhs);
361
+ }
362
+
363
+ inline bool operator<( const DateTime& lhs, const DateTime& rhs )
364
+ {
365
+ if( lhs.m_date < rhs.m_date )
366
+ return true;
367
+ else if( lhs.m_date > rhs.m_date )
368
+ return false;
369
+ else if( lhs.m_time < rhs.m_time )
370
+ return true;
371
+ return false;
372
+ }
373
+
374
+ inline bool operator>( const DateTime& lhs, const DateTime& rhs )
375
+ {
376
+ return !(lhs == rhs || lhs < rhs);
377
+ }
378
+
379
+ inline bool operator<=( const DateTime& lhs, const DateTime& rhs )
380
+ {
381
+ return lhs == rhs || lhs < rhs;
382
+ }
383
+
384
+ inline bool operator>=( const DateTime& lhs, const DateTime& rhs )
385
+ {
386
+ return lhs == rhs || lhs > rhs;
387
+ }
388
+
389
+ /// Calculate the difference between two DateTime values and return
390
+ /// the result as a number of seconds
391
+ inline int operator-( const DateTime& lhs, const DateTime& rhs )
392
+ {
393
+ return (DateTime::SECONDS_PER_DAY * (lhs.m_date - rhs.m_date) +
394
+ // Truncate the millis before subtracting
395
+ lhs.m_time / 1000 - rhs.m_time / 1000);
396
+ }
397
+
398
+ /// Date and Time represented in UTC.
399
+ class UtcTimeStamp : public DateTime
400
+ {
401
+ public:
402
+ /// Defaults to the current date and time
403
+ UtcTimeStamp()
404
+ : DateTime( DateTime::nowUtc() ) {}
405
+
406
+ /// Defaults to the current date
407
+ UtcTimeStamp( int hour, int minute, int second, int millisecond = 0 )
408
+ : DateTime( DateTime::nowUtc() )
409
+ {
410
+ setHMS( hour, minute, second, millisecond );
411
+ }
412
+
413
+ UtcTimeStamp( int hour, int minute, int second,
414
+ int date, int month, int year )
415
+ : DateTime( year, month, date, hour, minute, second, 0 ) {}
416
+
417
+ UtcTimeStamp( int hour, int minute, int second, int millisecond,
418
+ int date, int month, int year )
419
+ : DateTime( year, month, date, hour, minute, second, millisecond ) {}
420
+
421
+ explicit UtcTimeStamp( time_t time, int millisecond = 0 )
422
+ : DateTime( fromUtcTimeT (time, millisecond) ) {}
423
+
424
+ UtcTimeStamp( const tm* time, int millisecond = 0 )
425
+ : DateTime( fromTm (*time, millisecond) ) {}
426
+
427
+ void setCurrent()
428
+ {
429
+ set( DateTime::nowUtc() );
430
+ }
431
+ };
432
+
433
+ /// Date and Time represented in local time.
434
+ class LocalTimeStamp : public DateTime
435
+ {
436
+ public:
437
+ /// Defaults to the current date and time
438
+ LocalTimeStamp()
439
+ : DateTime( DateTime::nowLocal() ) {}
440
+
441
+ /// Defaults to the current date
442
+ LocalTimeStamp( int hour, int minute, int second, int millisecond = 0 )
443
+ : DateTime( DateTime::nowLocal() )
444
+ {
445
+ setHMS( hour, minute, second, millisecond );
446
+ }
447
+
448
+ LocalTimeStamp( int hour, int minute, int second,
449
+ int date, int month, int year )
450
+ : DateTime( year, month, date, hour, minute, second, 0 ) {}
451
+
452
+ LocalTimeStamp( int hour, int minute, int second, int millisecond,
453
+ int date, int month, int year )
454
+ : DateTime( year, month, date, hour, minute, second, millisecond ) {}
455
+
456
+ explicit LocalTimeStamp( time_t time, int millisecond = 0 )
457
+ : DateTime( fromLocalTimeT (time, millisecond) ) {}
458
+
459
+ LocalTimeStamp( const tm* time, int millisecond = 0 )
460
+ : DateTime( fromTm (*time, millisecond) ) {}
461
+
462
+ void setCurrent()
463
+ {
464
+ set( DateTime::nowLocal() );
465
+ }
466
+ };
467
+
468
+ /// Time only represented in UTC.
469
+ class UtcTimeOnly : public DateTime
470
+ {
471
+ public:
472
+ /// Defaults to the current time
473
+ UtcTimeOnly()
474
+ {
475
+ setCurrent();
476
+ }
477
+
478
+ UtcTimeOnly( const DateTime& val )
479
+ : DateTime(val)
480
+ {
481
+ clearDate();
482
+ }
483
+
484
+ UtcTimeOnly( int hour, int minute, int second, int millisecond = 0 )
485
+ {
486
+ setHMS( hour, minute, second, millisecond );
487
+ }
488
+
489
+ explicit UtcTimeOnly( time_t time, int millisecond = 0 )
490
+ : DateTime( fromUtcTimeT (time, millisecond) )
491
+ {
492
+ clearDate();
493
+ }
494
+
495
+ UtcTimeOnly( const tm* time, int millisecond = 0 )
496
+ : DateTime( fromTm (*time, millisecond) )
497
+ {
498
+ clearDate();
499
+ }
500
+
501
+ /// Set to the current time.
502
+ void setCurrent()
503
+ {
504
+ DateTime d = nowUtc();
505
+ m_time = d.m_time;
506
+ }
507
+ };
508
+
509
+ /// Time only represented in local time.
510
+ class LocalTimeOnly : public DateTime
511
+ {
512
+ public:
513
+ /// Defaults to the current time
514
+ LocalTimeOnly()
515
+ {
516
+ setCurrent();
517
+ }
518
+
519
+ LocalTimeOnly( const DateTime& val )
520
+ : DateTime(val)
521
+ {
522
+ clearDate();
523
+ }
524
+
525
+ LocalTimeOnly( int hour, int minute, int second, int millisecond = 0 )
526
+ {
527
+ setHMS( hour, minute, second, millisecond );
528
+ }
529
+
530
+ explicit LocalTimeOnly( time_t time, int millisecond = 0 )
531
+ : DateTime( fromLocalTimeT (time, millisecond) )
532
+ {
533
+ clearDate();
534
+ }
535
+
536
+ LocalTimeOnly( const tm* time, int millisecond = 0 )
537
+ : DateTime( fromTm (*time, millisecond) )
538
+ {
539
+ clearDate();
540
+ }
541
+
542
+ /// Set to the current time.
543
+ void setCurrent()
544
+ {
545
+ DateTime d = nowLocal();
546
+ m_time = d.m_time;
547
+ }
548
+ };
549
+
550
+ /// Date only represented in UTC.
551
+ class UtcDate : public DateTime
552
+ {
553
+ public:
554
+ /// Defaults to the current date
555
+ UtcDate()
556
+ {
557
+ setCurrent();
558
+ }
559
+
560
+ UtcDate( const DateTime& val )
561
+ : DateTime( val )
562
+ {
563
+ clearTime();
564
+ }
565
+
566
+ UtcDate( int date, int month, int year )
567
+ : DateTime(year, month, date, 0, 0, 0, 0) {}
568
+
569
+ UtcDate( int sec )
570
+ : DateTime( sec / DateTime::SECONDS_PER_DAY, 0 ) {}
571
+
572
+ UtcDate( const tm* time )
573
+ : DateTime( fromTm (*time) )
574
+ {
575
+ clearTime();
576
+ }
577
+
578
+ /// Set to the current time.
579
+ void setCurrent()
580
+ {
581
+ DateTime d = nowUtc();
582
+ m_date = d.m_date;
583
+ }
584
+ };
585
+
586
+ /// Date only represented in local time.
587
+ class LocalDate : public DateTime
588
+ {
589
+ public:
590
+ /// Defaults to the current date
591
+ LocalDate()
592
+ {
593
+ setCurrent();
594
+ }
595
+
596
+ LocalDate( const DateTime& val )
597
+ : DateTime( val )
598
+ {
599
+ clearTime();
600
+ }
601
+
602
+ LocalDate( int date, int month, int year )
603
+ : DateTime(year, month, date, 0, 0, 0, 0) {}
604
+
605
+ LocalDate( int sec )
606
+ : DateTime( sec / DateTime::SECONDS_PER_DAY, 0 ) {}
607
+
608
+ LocalDate( const tm* time )
609
+ : DateTime( fromTm (*time) )
610
+ {
611
+ clearTime();
612
+ }
613
+
614
+ /// Set to the current time.
615
+ void setCurrent()
616
+ {
617
+ DateTime d = nowLocal();
618
+ m_date = d.m_date;
619
+ }
620
+ };
621
+
622
+ /*! @} */
623
+
624
+ typedef UtcDate UtcDateOnly;
625
+
626
+ typedef std::string STRING;
627
+ typedef char CHAR;
628
+ typedef double PRICE;
629
+ typedef int INT;
630
+ typedef double AMT;
631
+ typedef double QTY;
632
+ typedef std::string CURRENCY;
633
+ typedef std::string MULTIPLEVALUESTRING;
634
+ typedef std::string MULTIPLESTRINGVALUE;
635
+ typedef std::string MULTIPLECHARVALUE;
636
+ typedef std::string EXCHANGE;
637
+ typedef UtcTimeStamp UTCTIMESTAMP;
638
+ typedef bool BOOLEAN;
639
+ typedef std::string LOCALMKTDATE;
640
+ typedef std::string DATA;
641
+ typedef double FLOAT;
642
+ typedef double PRICEOFFSET;
643
+ typedef std::string MONTHYEAR;
644
+ typedef std::string DAYOFMONTH;
645
+ typedef UtcDate UTCDATE;
646
+ typedef UtcDateOnly UTCDATEONLY;
647
+ typedef UtcTimeOnly UTCTIMEONLY;
648
+ typedef int NUMINGROUP;
649
+ typedef double PERCENTAGE;
650
+ typedef int SEQNUM;
651
+ typedef int LENGTH;
652
+ typedef std::string COUNTRY;
653
+ typedef std::string TZTIMEONLY;
654
+ typedef std::string TZTIMESTAMP;
655
+ typedef std::string XMLDATA;
656
+ typedef std::string LANGUAGE;
657
+
658
+ namespace TYPE
659
+ {
660
+ enum Type
661
+ {
662
+ Unknown,
663
+ String,
664
+ Char,
665
+ Price,
666
+ Int,
667
+ Amt,
668
+ Qty,
669
+ Currency,
670
+ MultipleValueString,
671
+ MultipleStringValue,
672
+ MultipleCharValue,
673
+ Exchange,
674
+ UtcTimeStamp,
675
+ Boolean,
676
+ LocalMktDate,
677
+ Data,
678
+ Float,
679
+ PriceOffset,
680
+ MonthYear,
681
+ DayOfMonth,
682
+ UtcDate,
683
+ UtcDateOnly = UtcDate,
684
+ UtcTimeOnly,
685
+ NumInGroup,
686
+ Percentage,
687
+ SeqNum,
688
+ Length,
689
+ Country,
690
+ TzTimeOnly,
691
+ TzTimeStamp,
692
+ XmlData,
693
+ Language
694
+ };
695
+ }
696
+ }
697
+
698
+ #endif //FIX_FIELDTYPES_H
@@ -0,0 +1,31 @@
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_FIELDS_BASE_H
23
+ #define FIX_FIELDS_BASE_H
24
+
25
+ #include "FixFields.h"
26
+ #include "Field.h"
27
+
28
+ #undef Yield
29
+
30
+ #endif //FIX_FIELDS_BASE_H
31
+