MessageCracker.h 29 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312313314315316317318319320321322323324325326327328329330331332333334335336337338339340341342343344345346347348349350351352353354355356357358359360361362363364365366367368369370371372373374375376377378379380381382383384385386387388389390391392393394395396397398399400401402403404405406407408409410411412413414415416417418419420421422423424425426427428429430431432433434435436437438439440441442443444445446447448449450451452453454455456457458459460461462463464465466467468469470471472473474475476477478479480481482483484485486487488489490491492493494495496497498499500501502503504505506507508509510511512513514515516517518519520521522523524525526527528529530531532533534535536537538539540541542543544545546547548549550551552553554555556557558559560561562563564565566567568569570571572573574575576577578579580581582583584585586587588589590591592593594595596597598599600601602603604605606607608609610611612613614615616617618619620621622623624625626627628629630631632633634635636637638639640641642643644645646647648649650651652653654655656657658659660661662663664665666667668669670671672673674675676677678679680681682683684685686687688689690691692693694695696697698699700701702703704705706707708709710711712713714715716717718719720721722723724725726727728729730731732733734735736737738739740741742743744
  1. /* -*- C++ -*- */
  2. /****************************************************************************
  3. ** Copyright (c) 2001-2014
  4. **
  5. ** This file is part of the QuickFIX FIX Engine
  6. **
  7. ** This file may be distributed under the terms of the quickfixengine.org
  8. ** license as defined by quickfixengine.org and appearing in the file
  9. ** LICENSE included in the packaging of this file.
  10. **
  11. ** This file is provided AS IS with NO WARRANTY OF ANY KIND, INCLUDING THE
  12. ** WARRANTY OF DESIGN, MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE.
  13. **
  14. ** See http://www.quickfixengine.org/LICENSE for licensing information.
  15. **
  16. ** Contact ask@quickfixengine.org if any conditions of this licensing are
  17. ** not clear to you.
  18. **
  19. ****************************************************************************/
  20. #ifndef FIX43_MESSAGECRACKER_H
  21. #define FIX43_MESSAGECRACKER_H
  22. #include "../SessionID.h"
  23. #include "../Exceptions.h"
  24. #include "../fix43/Message.h"
  25. namespace FIX43
  26. {
  27. class Heartbeat;
  28. class TestRequest;
  29. class ResendRequest;
  30. class Reject;
  31. class SequenceReset;
  32. class Logout;
  33. class IOI;
  34. class Advertisement;
  35. class ExecutionReport;
  36. class OrderCancelReject;
  37. class Logon;
  38. class News;
  39. class Email;
  40. class NewOrderSingle;
  41. class NewOrderList;
  42. class OrderCancelRequest;
  43. class OrderCancelReplaceRequest;
  44. class OrderStatusRequest;
  45. class Allocation;
  46. class ListCancelRequest;
  47. class ListExecute;
  48. class ListStatusRequest;
  49. class ListStatus;
  50. class AllocationAck;
  51. class DontKnowTrade;
  52. class QuoteRequest;
  53. class Quote;
  54. class SettlementInstructions;
  55. class MarketDataRequest;
  56. class MarketDataSnapshotFullRefresh;
  57. class MarketDataIncrementalRefresh;
  58. class MarketDataRequestReject;
  59. class QuoteCancel;
  60. class QuoteStatusRequest;
  61. class MassQuoteAcknowledgement;
  62. class SecurityDefinitionRequest;
  63. class SecurityDefinition;
  64. class SecurityStatusRequest;
  65. class SecurityStatus;
  66. class TradingSessionStatusRequest;
  67. class TradingSessionStatus;
  68. class MassQuote;
  69. class BusinessMessageReject;
  70. class BidRequest;
  71. class BidResponse;
  72. class ListStrikePrice;
  73. class XMLnonFIX;
  74. class RegistrationInstructions;
  75. class RegistrationInstructionsResponse;
  76. class OrderMassCancelRequest;
  77. class OrderMassCancelReport;
  78. class NewOrderCross;
  79. class CrossOrderCancelRequest;
  80. class CrossOrderCancelReplaceRequest;
  81. class SecurityTypeRequest;
  82. class SecurityTypes;
  83. class SecurityListRequest;
  84. class SecurityList;
  85. class DerivativeSecurityListRequest;
  86. class DerivativeSecurityList;
  87. class NewOrderMultileg;
  88. class MultilegOrderCancelReplaceRequest;
  89. class TradeCaptureReportRequest;
  90. class TradeCaptureReport;
  91. class OrderMassStatusRequest;
  92. class QuoteRequestReject;
  93. class RFQRequest;
  94. class QuoteStatusReport;
  95. class MessageCracker
  96. {
  97. public:
  98. virtual ~MessageCracker() {}
  99. virtual void onMessage( const Message&, const FIX::SessionID& )
  100. { throw FIX::UnsupportedMessageType(); }
  101. virtual void onMessage( Message&, const FIX::SessionID& )
  102. { throw FIX::UnsupportedMessageType(); }
  103. virtual void onMessage( const Heartbeat&, const FIX::SessionID& )
  104. {}
  105. virtual void onMessage( const TestRequest&, const FIX::SessionID& )
  106. {}
  107. virtual void onMessage( const ResendRequest&, const FIX::SessionID& )
  108. {}
  109. virtual void onMessage( const Reject&, const FIX::SessionID& )
  110. {}
  111. virtual void onMessage( const SequenceReset&, const FIX::SessionID& )
  112. {}
  113. virtual void onMessage( const Logout&, const FIX::SessionID& )
  114. {}
  115. virtual void onMessage( const IOI&, const FIX::SessionID& )
  116. { throw FIX::UnsupportedMessageType(); }
  117. virtual void onMessage( const Advertisement&, const FIX::SessionID& )
  118. { throw FIX::UnsupportedMessageType(); }
  119. virtual void onMessage( const ExecutionReport&, const FIX::SessionID& )
  120. { throw FIX::UnsupportedMessageType(); }
  121. virtual void onMessage( const OrderCancelReject&, const FIX::SessionID& )
  122. { throw FIX::UnsupportedMessageType(); }
  123. virtual void onMessage( const Logon&, const FIX::SessionID& )
  124. {}
  125. virtual void onMessage( const News&, const FIX::SessionID& )
  126. { throw FIX::UnsupportedMessageType(); }
  127. virtual void onMessage( const Email&, const FIX::SessionID& )
  128. { throw FIX::UnsupportedMessageType(); }
  129. virtual void onMessage( const NewOrderSingle&, const FIX::SessionID& )
  130. { throw FIX::UnsupportedMessageType(); }
  131. virtual void onMessage( const NewOrderList&, const FIX::SessionID& )
  132. { throw FIX::UnsupportedMessageType(); }
  133. virtual void onMessage( const OrderCancelRequest&, const FIX::SessionID& )
  134. { throw FIX::UnsupportedMessageType(); }
  135. virtual void onMessage( const OrderCancelReplaceRequest&, const FIX::SessionID& )
  136. { throw FIX::UnsupportedMessageType(); }
  137. virtual void onMessage( const OrderStatusRequest&, const FIX::SessionID& )
  138. { throw FIX::UnsupportedMessageType(); }
  139. virtual void onMessage( const Allocation&, const FIX::SessionID& )
  140. { throw FIX::UnsupportedMessageType(); }
  141. virtual void onMessage( const ListCancelRequest&, const FIX::SessionID& )
  142. { throw FIX::UnsupportedMessageType(); }
  143. virtual void onMessage( const ListExecute&, const FIX::SessionID& )
  144. { throw FIX::UnsupportedMessageType(); }
  145. virtual void onMessage( const ListStatusRequest&, const FIX::SessionID& )
  146. { throw FIX::UnsupportedMessageType(); }
  147. virtual void onMessage( const ListStatus&, const FIX::SessionID& )
  148. { throw FIX::UnsupportedMessageType(); }
  149. virtual void onMessage( const AllocationAck&, const FIX::SessionID& )
  150. { throw FIX::UnsupportedMessageType(); }
  151. virtual void onMessage( const DontKnowTrade&, const FIX::SessionID& )
  152. { throw FIX::UnsupportedMessageType(); }
  153. virtual void onMessage( const QuoteRequest&, const FIX::SessionID& )
  154. { throw FIX::UnsupportedMessageType(); }
  155. virtual void onMessage( const Quote&, const FIX::SessionID& )
  156. { throw FIX::UnsupportedMessageType(); }
  157. virtual void onMessage( const SettlementInstructions&, const FIX::SessionID& )
  158. { throw FIX::UnsupportedMessageType(); }
  159. virtual void onMessage( const MarketDataRequest&, const FIX::SessionID& )
  160. { throw FIX::UnsupportedMessageType(); }
  161. virtual void onMessage( const MarketDataSnapshotFullRefresh&, const FIX::SessionID& )
  162. { throw FIX::UnsupportedMessageType(); }
  163. virtual void onMessage( const MarketDataIncrementalRefresh&, const FIX::SessionID& )
  164. { throw FIX::UnsupportedMessageType(); }
  165. virtual void onMessage( const MarketDataRequestReject&, const FIX::SessionID& )
  166. { throw FIX::UnsupportedMessageType(); }
  167. virtual void onMessage( const QuoteCancel&, const FIX::SessionID& )
  168. { throw FIX::UnsupportedMessageType(); }
  169. virtual void onMessage( const QuoteStatusRequest&, const FIX::SessionID& )
  170. { throw FIX::UnsupportedMessageType(); }
  171. virtual void onMessage( const MassQuoteAcknowledgement&, const FIX::SessionID& )
  172. { throw FIX::UnsupportedMessageType(); }
  173. virtual void onMessage( const SecurityDefinitionRequest&, const FIX::SessionID& )
  174. { throw FIX::UnsupportedMessageType(); }
  175. virtual void onMessage( const SecurityDefinition&, const FIX::SessionID& )
  176. { throw FIX::UnsupportedMessageType(); }
  177. virtual void onMessage( const SecurityStatusRequest&, const FIX::SessionID& )
  178. { throw FIX::UnsupportedMessageType(); }
  179. virtual void onMessage( const SecurityStatus&, const FIX::SessionID& )
  180. { throw FIX::UnsupportedMessageType(); }
  181. virtual void onMessage( const TradingSessionStatusRequest&, const FIX::SessionID& )
  182. { throw FIX::UnsupportedMessageType(); }
  183. virtual void onMessage( const TradingSessionStatus&, const FIX::SessionID& )
  184. { throw FIX::UnsupportedMessageType(); }
  185. virtual void onMessage( const MassQuote&, const FIX::SessionID& )
  186. { throw FIX::UnsupportedMessageType(); }
  187. virtual void onMessage( const BusinessMessageReject&, const FIX::SessionID& )
  188. {}
  189. virtual void onMessage( const BidRequest&, const FIX::SessionID& )
  190. { throw FIX::UnsupportedMessageType(); }
  191. virtual void onMessage( const BidResponse&, const FIX::SessionID& )
  192. { throw FIX::UnsupportedMessageType(); }
  193. virtual void onMessage( const ListStrikePrice&, const FIX::SessionID& )
  194. { throw FIX::UnsupportedMessageType(); }
  195. virtual void onMessage( const XMLnonFIX&, const FIX::SessionID& )
  196. {}
  197. virtual void onMessage( const RegistrationInstructions&, const FIX::SessionID& )
  198. { throw FIX::UnsupportedMessageType(); }
  199. virtual void onMessage( const RegistrationInstructionsResponse&, const FIX::SessionID& )
  200. { throw FIX::UnsupportedMessageType(); }
  201. virtual void onMessage( const OrderMassCancelRequest&, const FIX::SessionID& )
  202. { throw FIX::UnsupportedMessageType(); }
  203. virtual void onMessage( const OrderMassCancelReport&, const FIX::SessionID& )
  204. { throw FIX::UnsupportedMessageType(); }
  205. virtual void onMessage( const NewOrderCross&, const FIX::SessionID& )
  206. { throw FIX::UnsupportedMessageType(); }
  207. virtual void onMessage( const CrossOrderCancelRequest&, const FIX::SessionID& )
  208. { throw FIX::UnsupportedMessageType(); }
  209. virtual void onMessage( const CrossOrderCancelReplaceRequest&, const FIX::SessionID& )
  210. { throw FIX::UnsupportedMessageType(); }
  211. virtual void onMessage( const SecurityTypeRequest&, const FIX::SessionID& )
  212. { throw FIX::UnsupportedMessageType(); }
  213. virtual void onMessage( const SecurityTypes&, const FIX::SessionID& )
  214. { throw FIX::UnsupportedMessageType(); }
  215. virtual void onMessage( const SecurityListRequest&, const FIX::SessionID& )
  216. { throw FIX::UnsupportedMessageType(); }
  217. virtual void onMessage( const SecurityList&, const FIX::SessionID& )
  218. { throw FIX::UnsupportedMessageType(); }
  219. virtual void onMessage( const DerivativeSecurityListRequest&, const FIX::SessionID& )
  220. { throw FIX::UnsupportedMessageType(); }
  221. virtual void onMessage( const DerivativeSecurityList&, const FIX::SessionID& )
  222. { throw FIX::UnsupportedMessageType(); }
  223. virtual void onMessage( const NewOrderMultileg&, const FIX::SessionID& )
  224. { throw FIX::UnsupportedMessageType(); }
  225. virtual void onMessage( const MultilegOrderCancelReplaceRequest&, const FIX::SessionID& )
  226. { throw FIX::UnsupportedMessageType(); }
  227. virtual void onMessage( const TradeCaptureReportRequest&, const FIX::SessionID& )
  228. { throw FIX::UnsupportedMessageType(); }
  229. virtual void onMessage( const TradeCaptureReport&, const FIX::SessionID& )
  230. { throw FIX::UnsupportedMessageType(); }
  231. virtual void onMessage( const OrderMassStatusRequest&, const FIX::SessionID& )
  232. { throw FIX::UnsupportedMessageType(); }
  233. virtual void onMessage( const QuoteRequestReject&, const FIX::SessionID& )
  234. { throw FIX::UnsupportedMessageType(); }
  235. virtual void onMessage( const RFQRequest&, const FIX::SessionID& )
  236. { throw FIX::UnsupportedMessageType(); }
  237. virtual void onMessage( const QuoteStatusReport&, const FIX::SessionID& )
  238. { throw FIX::UnsupportedMessageType(); }
  239. virtual void onMessage( Heartbeat&, const FIX::SessionID& ) {}
  240. virtual void onMessage( TestRequest&, const FIX::SessionID& ) {}
  241. virtual void onMessage( ResendRequest&, const FIX::SessionID& ) {}
  242. virtual void onMessage( Reject&, const FIX::SessionID& ) {}
  243. virtual void onMessage( SequenceReset&, const FIX::SessionID& ) {}
  244. virtual void onMessage( Logout&, const FIX::SessionID& ) {}
  245. virtual void onMessage( IOI&, const FIX::SessionID& ) {}
  246. virtual void onMessage( Advertisement&, const FIX::SessionID& ) {}
  247. virtual void onMessage( ExecutionReport&, const FIX::SessionID& ) {}
  248. virtual void onMessage( OrderCancelReject&, const FIX::SessionID& ) {}
  249. virtual void onMessage( Logon&, const FIX::SessionID& ) {}
  250. virtual void onMessage( News&, const FIX::SessionID& ) {}
  251. virtual void onMessage( Email&, const FIX::SessionID& ) {}
  252. virtual void onMessage( NewOrderSingle&, const FIX::SessionID& ) {}
  253. virtual void onMessage( NewOrderList&, const FIX::SessionID& ) {}
  254. virtual void onMessage( OrderCancelRequest&, const FIX::SessionID& ) {}
  255. virtual void onMessage( OrderCancelReplaceRequest&, const FIX::SessionID& ) {}
  256. virtual void onMessage( OrderStatusRequest&, const FIX::SessionID& ) {}
  257. virtual void onMessage( Allocation&, const FIX::SessionID& ) {}
  258. virtual void onMessage( ListCancelRequest&, const FIX::SessionID& ) {}
  259. virtual void onMessage( ListExecute&, const FIX::SessionID& ) {}
  260. virtual void onMessage( ListStatusRequest&, const FIX::SessionID& ) {}
  261. virtual void onMessage( ListStatus&, const FIX::SessionID& ) {}
  262. virtual void onMessage( AllocationAck&, const FIX::SessionID& ) {}
  263. virtual void onMessage( DontKnowTrade&, const FIX::SessionID& ) {}
  264. virtual void onMessage( QuoteRequest&, const FIX::SessionID& ) {}
  265. virtual void onMessage( Quote&, const FIX::SessionID& ) {}
  266. virtual void onMessage( SettlementInstructions&, const FIX::SessionID& ) {}
  267. virtual void onMessage( MarketDataRequest&, const FIX::SessionID& ) {}
  268. virtual void onMessage( MarketDataSnapshotFullRefresh&, const FIX::SessionID& ) {}
  269. virtual void onMessage( MarketDataIncrementalRefresh&, const FIX::SessionID& ) {}
  270. virtual void onMessage( MarketDataRequestReject&, const FIX::SessionID& ) {}
  271. virtual void onMessage( QuoteCancel&, const FIX::SessionID& ) {}
  272. virtual void onMessage( QuoteStatusRequest&, const FIX::SessionID& ) {}
  273. virtual void onMessage( MassQuoteAcknowledgement&, const FIX::SessionID& ) {}
  274. virtual void onMessage( SecurityDefinitionRequest&, const FIX::SessionID& ) {}
  275. virtual void onMessage( SecurityDefinition&, const FIX::SessionID& ) {}
  276. virtual void onMessage( SecurityStatusRequest&, const FIX::SessionID& ) {}
  277. virtual void onMessage( SecurityStatus&, const FIX::SessionID& ) {}
  278. virtual void onMessage( TradingSessionStatusRequest&, const FIX::SessionID& ) {}
  279. virtual void onMessage( TradingSessionStatus&, const FIX::SessionID& ) {}
  280. virtual void onMessage( MassQuote&, const FIX::SessionID& ) {}
  281. virtual void onMessage( BusinessMessageReject&, const FIX::SessionID& ) {}
  282. virtual void onMessage( BidRequest&, const FIX::SessionID& ) {}
  283. virtual void onMessage( BidResponse&, const FIX::SessionID& ) {}
  284. virtual void onMessage( ListStrikePrice&, const FIX::SessionID& ) {}
  285. virtual void onMessage( XMLnonFIX&, const FIX::SessionID& ) {}
  286. virtual void onMessage( RegistrationInstructions&, const FIX::SessionID& ) {}
  287. virtual void onMessage( RegistrationInstructionsResponse&, const FIX::SessionID& ) {}
  288. virtual void onMessage( OrderMassCancelRequest&, const FIX::SessionID& ) {}
  289. virtual void onMessage( OrderMassCancelReport&, const FIX::SessionID& ) {}
  290. virtual void onMessage( NewOrderCross&, const FIX::SessionID& ) {}
  291. virtual void onMessage( CrossOrderCancelRequest&, const FIX::SessionID& ) {}
  292. virtual void onMessage( CrossOrderCancelReplaceRequest&, const FIX::SessionID& ) {}
  293. virtual void onMessage( SecurityTypeRequest&, const FIX::SessionID& ) {}
  294. virtual void onMessage( SecurityTypes&, const FIX::SessionID& ) {}
  295. virtual void onMessage( SecurityListRequest&, const FIX::SessionID& ) {}
  296. virtual void onMessage( SecurityList&, const FIX::SessionID& ) {}
  297. virtual void onMessage( DerivativeSecurityListRequest&, const FIX::SessionID& ) {}
  298. virtual void onMessage( DerivativeSecurityList&, const FIX::SessionID& ) {}
  299. virtual void onMessage( NewOrderMultileg&, const FIX::SessionID& ) {}
  300. virtual void onMessage( MultilegOrderCancelReplaceRequest&, const FIX::SessionID& ) {}
  301. virtual void onMessage( TradeCaptureReportRequest&, const FIX::SessionID& ) {}
  302. virtual void onMessage( TradeCaptureReport&, const FIX::SessionID& ) {}
  303. virtual void onMessage( OrderMassStatusRequest&, const FIX::SessionID& ) {}
  304. virtual void onMessage( QuoteRequestReject&, const FIX::SessionID& ) {}
  305. virtual void onMessage( RFQRequest&, const FIX::SessionID& ) {}
  306. virtual void onMessage( QuoteStatusReport&, const FIX::SessionID& ) {}
  307. public:
  308. void crack( const Message& message,
  309. const FIX::SessionID& sessionID )
  310. {
  311. const std::string& msgTypeValue
  312. = message.getHeader().getField( FIX::FIELD::MsgType );
  313. if( msgTypeValue == "0" )
  314. onMessage( (const Heartbeat&)message, sessionID );
  315. else
  316. if( msgTypeValue == "1" )
  317. onMessage( (const TestRequest&)message, sessionID );
  318. else
  319. if( msgTypeValue == "2" )
  320. onMessage( (const ResendRequest&)message, sessionID );
  321. else
  322. if( msgTypeValue == "3" )
  323. onMessage( (const Reject&)message, sessionID );
  324. else
  325. if( msgTypeValue == "4" )
  326. onMessage( (const SequenceReset&)message, sessionID );
  327. else
  328. if( msgTypeValue == "5" )
  329. onMessage( (const Logout&)message, sessionID );
  330. else
  331. if( msgTypeValue == "6" )
  332. onMessage( (const IOI&)message, sessionID );
  333. else
  334. if( msgTypeValue == "7" )
  335. onMessage( (const Advertisement&)message, sessionID );
  336. else
  337. if( msgTypeValue == "8" )
  338. onMessage( (const ExecutionReport&)message, sessionID );
  339. else
  340. if( msgTypeValue == "9" )
  341. onMessage( (const OrderCancelReject&)message, sessionID );
  342. else
  343. if( msgTypeValue == "A" )
  344. onMessage( (const Logon&)message, sessionID );
  345. else
  346. if( msgTypeValue == "B" )
  347. onMessage( (const News&)message, sessionID );
  348. else
  349. if( msgTypeValue == "C" )
  350. onMessage( (const Email&)message, sessionID );
  351. else
  352. if( msgTypeValue == "D" )
  353. onMessage( (const NewOrderSingle&)message, sessionID );
  354. else
  355. if( msgTypeValue == "E" )
  356. onMessage( (const NewOrderList&)message, sessionID );
  357. else
  358. if( msgTypeValue == "F" )
  359. onMessage( (const OrderCancelRequest&)message, sessionID );
  360. else
  361. if( msgTypeValue == "G" )
  362. onMessage( (const OrderCancelReplaceRequest&)message, sessionID );
  363. else
  364. if( msgTypeValue == "H" )
  365. onMessage( (const OrderStatusRequest&)message, sessionID );
  366. else
  367. if( msgTypeValue == "J" )
  368. onMessage( (const Allocation&)message, sessionID );
  369. else
  370. if( msgTypeValue == "K" )
  371. onMessage( (const ListCancelRequest&)message, sessionID );
  372. else
  373. if( msgTypeValue == "L" )
  374. onMessage( (const ListExecute&)message, sessionID );
  375. else
  376. if( msgTypeValue == "M" )
  377. onMessage( (const ListStatusRequest&)message, sessionID );
  378. else
  379. if( msgTypeValue == "N" )
  380. onMessage( (const ListStatus&)message, sessionID );
  381. else
  382. if( msgTypeValue == "P" )
  383. onMessage( (const AllocationAck&)message, sessionID );
  384. else
  385. if( msgTypeValue == "Q" )
  386. onMessage( (const DontKnowTrade&)message, sessionID );
  387. else
  388. if( msgTypeValue == "R" )
  389. onMessage( (const QuoteRequest&)message, sessionID );
  390. else
  391. if( msgTypeValue == "S" )
  392. onMessage( (const Quote&)message, sessionID );
  393. else
  394. if( msgTypeValue == "T" )
  395. onMessage( (const SettlementInstructions&)message, sessionID );
  396. else
  397. if( msgTypeValue == "V" )
  398. onMessage( (const MarketDataRequest&)message, sessionID );
  399. else
  400. if( msgTypeValue == "W" )
  401. onMessage( (const MarketDataSnapshotFullRefresh&)message, sessionID );
  402. else
  403. if( msgTypeValue == "X" )
  404. onMessage( (const MarketDataIncrementalRefresh&)message, sessionID );
  405. else
  406. if( msgTypeValue == "Y" )
  407. onMessage( (const MarketDataRequestReject&)message, sessionID );
  408. else
  409. if( msgTypeValue == "Z" )
  410. onMessage( (const QuoteCancel&)message, sessionID );
  411. else
  412. if( msgTypeValue == "a" )
  413. onMessage( (const QuoteStatusRequest&)message, sessionID );
  414. else
  415. if( msgTypeValue == "b" )
  416. onMessage( (const MassQuoteAcknowledgement&)message, sessionID );
  417. else
  418. if( msgTypeValue == "c" )
  419. onMessage( (const SecurityDefinitionRequest&)message, sessionID );
  420. else
  421. if( msgTypeValue == "d" )
  422. onMessage( (const SecurityDefinition&)message, sessionID );
  423. else
  424. if( msgTypeValue == "e" )
  425. onMessage( (const SecurityStatusRequest&)message, sessionID );
  426. else
  427. if( msgTypeValue == "f" )
  428. onMessage( (const SecurityStatus&)message, sessionID );
  429. else
  430. if( msgTypeValue == "g" )
  431. onMessage( (const TradingSessionStatusRequest&)message, sessionID );
  432. else
  433. if( msgTypeValue == "h" )
  434. onMessage( (const TradingSessionStatus&)message, sessionID );
  435. else
  436. if( msgTypeValue == "i" )
  437. onMessage( (const MassQuote&)message, sessionID );
  438. else
  439. if( msgTypeValue == "j" )
  440. onMessage( (const BusinessMessageReject&)message, sessionID );
  441. else
  442. if( msgTypeValue == "k" )
  443. onMessage( (const BidRequest&)message, sessionID );
  444. else
  445. if( msgTypeValue == "l" )
  446. onMessage( (const BidResponse&)message, sessionID );
  447. else
  448. if( msgTypeValue == "m" )
  449. onMessage( (const ListStrikePrice&)message, sessionID );
  450. else
  451. if( msgTypeValue == "n" )
  452. onMessage( (const XMLnonFIX&)message, sessionID );
  453. else
  454. if( msgTypeValue == "o" )
  455. onMessage( (const RegistrationInstructions&)message, sessionID );
  456. else
  457. if( msgTypeValue == "p" )
  458. onMessage( (const RegistrationInstructionsResponse&)message, sessionID );
  459. else
  460. if( msgTypeValue == "q" )
  461. onMessage( (const OrderMassCancelRequest&)message, sessionID );
  462. else
  463. if( msgTypeValue == "r" )
  464. onMessage( (const OrderMassCancelReport&)message, sessionID );
  465. else
  466. if( msgTypeValue == "s" )
  467. onMessage( (const NewOrderCross&)message, sessionID );
  468. else
  469. if( msgTypeValue == "u" )
  470. onMessage( (const CrossOrderCancelRequest&)message, sessionID );
  471. else
  472. if( msgTypeValue == "t" )
  473. onMessage( (const CrossOrderCancelReplaceRequest&)message, sessionID );
  474. else
  475. if( msgTypeValue == "v" )
  476. onMessage( (const SecurityTypeRequest&)message, sessionID );
  477. else
  478. if( msgTypeValue == "w" )
  479. onMessage( (const SecurityTypes&)message, sessionID );
  480. else
  481. if( msgTypeValue == "x" )
  482. onMessage( (const SecurityListRequest&)message, sessionID );
  483. else
  484. if( msgTypeValue == "y" )
  485. onMessage( (const SecurityList&)message, sessionID );
  486. else
  487. if( msgTypeValue == "z" )
  488. onMessage( (const DerivativeSecurityListRequest&)message, sessionID );
  489. else
  490. if( msgTypeValue == "AA" )
  491. onMessage( (const DerivativeSecurityList&)message, sessionID );
  492. else
  493. if( msgTypeValue == "AB" )
  494. onMessage( (const NewOrderMultileg&)message, sessionID );
  495. else
  496. if( msgTypeValue == "AC" )
  497. onMessage( (const MultilegOrderCancelReplaceRequest&)message, sessionID );
  498. else
  499. if( msgTypeValue == "AD" )
  500. onMessage( (const TradeCaptureReportRequest&)message, sessionID );
  501. else
  502. if( msgTypeValue == "AE" )
  503. onMessage( (const TradeCaptureReport&)message, sessionID );
  504. else
  505. if( msgTypeValue == "AF" )
  506. onMessage( (const OrderMassStatusRequest&)message, sessionID );
  507. else
  508. if( msgTypeValue == "AG" )
  509. onMessage( (const QuoteRequestReject&)message, sessionID );
  510. else
  511. if( msgTypeValue == "AH" )
  512. onMessage( (const RFQRequest&)message, sessionID );
  513. else
  514. if( msgTypeValue == "AI" )
  515. onMessage( (const QuoteStatusReport&)message, sessionID );
  516. else onMessage( message, sessionID );
  517. }
  518. void crack( Message& message,
  519. const FIX::SessionID& sessionID )
  520. {
  521. FIX::MsgType msgType;
  522. message.getHeader().getField(msgType);
  523. std::string msgTypeValue = msgType.getValue();
  524. if( msgTypeValue == "0" )
  525. onMessage( (Heartbeat&)message, sessionID );
  526. else
  527. if( msgTypeValue == "1" )
  528. onMessage( (TestRequest&)message, sessionID );
  529. else
  530. if( msgTypeValue == "2" )
  531. onMessage( (ResendRequest&)message, sessionID );
  532. else
  533. if( msgTypeValue == "3" )
  534. onMessage( (Reject&)message, sessionID );
  535. else
  536. if( msgTypeValue == "4" )
  537. onMessage( (SequenceReset&)message, sessionID );
  538. else
  539. if( msgTypeValue == "5" )
  540. onMessage( (Logout&)message, sessionID );
  541. else
  542. if( msgTypeValue == "6" )
  543. onMessage( (IOI&)message, sessionID );
  544. else
  545. if( msgTypeValue == "7" )
  546. onMessage( (Advertisement&)message, sessionID );
  547. else
  548. if( msgTypeValue == "8" )
  549. onMessage( (ExecutionReport&)message, sessionID );
  550. else
  551. if( msgTypeValue == "9" )
  552. onMessage( (OrderCancelReject&)message, sessionID );
  553. else
  554. if( msgTypeValue == "A" )
  555. onMessage( (Logon&)message, sessionID );
  556. else
  557. if( msgTypeValue == "B" )
  558. onMessage( (News&)message, sessionID );
  559. else
  560. if( msgTypeValue == "C" )
  561. onMessage( (Email&)message, sessionID );
  562. else
  563. if( msgTypeValue == "D" )
  564. onMessage( (NewOrderSingle&)message, sessionID );
  565. else
  566. if( msgTypeValue == "E" )
  567. onMessage( (NewOrderList&)message, sessionID );
  568. else
  569. if( msgTypeValue == "F" )
  570. onMessage( (OrderCancelRequest&)message, sessionID );
  571. else
  572. if( msgTypeValue == "G" )
  573. onMessage( (OrderCancelReplaceRequest&)message, sessionID );
  574. else
  575. if( msgTypeValue == "H" )
  576. onMessage( (OrderStatusRequest&)message, sessionID );
  577. else
  578. if( msgTypeValue == "J" )
  579. onMessage( (Allocation&)message, sessionID );
  580. else
  581. if( msgTypeValue == "K" )
  582. onMessage( (ListCancelRequest&)message, sessionID );
  583. else
  584. if( msgTypeValue == "L" )
  585. onMessage( (ListExecute&)message, sessionID );
  586. else
  587. if( msgTypeValue == "M" )
  588. onMessage( (ListStatusRequest&)message, sessionID );
  589. else
  590. if( msgTypeValue == "N" )
  591. onMessage( (ListStatus&)message, sessionID );
  592. else
  593. if( msgTypeValue == "P" )
  594. onMessage( (AllocationAck&)message, sessionID );
  595. else
  596. if( msgTypeValue == "Q" )
  597. onMessage( (DontKnowTrade&)message, sessionID );
  598. else
  599. if( msgTypeValue == "R" )
  600. onMessage( (QuoteRequest&)message, sessionID );
  601. else
  602. if( msgTypeValue == "S" )
  603. onMessage( (Quote&)message, sessionID );
  604. else
  605. if( msgTypeValue == "T" )
  606. onMessage( (SettlementInstructions&)message, sessionID );
  607. else
  608. if( msgTypeValue == "V" )
  609. onMessage( (MarketDataRequest&)message, sessionID );
  610. else
  611. if( msgTypeValue == "W" )
  612. onMessage( (MarketDataSnapshotFullRefresh&)message, sessionID );
  613. else
  614. if( msgTypeValue == "X" )
  615. onMessage( (MarketDataIncrementalRefresh&)message, sessionID );
  616. else
  617. if( msgTypeValue == "Y" )
  618. onMessage( (MarketDataRequestReject&)message, sessionID );
  619. else
  620. if( msgTypeValue == "Z" )
  621. onMessage( (QuoteCancel&)message, sessionID );
  622. else
  623. if( msgTypeValue == "a" )
  624. onMessage( (QuoteStatusRequest&)message, sessionID );
  625. else
  626. if( msgTypeValue == "b" )
  627. onMessage( (MassQuoteAcknowledgement&)message, sessionID );
  628. else
  629. if( msgTypeValue == "c" )
  630. onMessage( (SecurityDefinitionRequest&)message, sessionID );
  631. else
  632. if( msgTypeValue == "d" )
  633. onMessage( (SecurityDefinition&)message, sessionID );
  634. else
  635. if( msgTypeValue == "e" )
  636. onMessage( (SecurityStatusRequest&)message, sessionID );
  637. else
  638. if( msgTypeValue == "f" )
  639. onMessage( (SecurityStatus&)message, sessionID );
  640. else
  641. if( msgTypeValue == "g" )
  642. onMessage( (TradingSessionStatusRequest&)message, sessionID );
  643. else
  644. if( msgTypeValue == "h" )
  645. onMessage( (TradingSessionStatus&)message, sessionID );
  646. else
  647. if( msgTypeValue == "i" )
  648. onMessage( (MassQuote&)message, sessionID );
  649. else
  650. if( msgTypeValue == "j" )
  651. onMessage( (BusinessMessageReject&)message, sessionID );
  652. else
  653. if( msgTypeValue == "k" )
  654. onMessage( (BidRequest&)message, sessionID );
  655. else
  656. if( msgTypeValue == "l" )
  657. onMessage( (BidResponse&)message, sessionID );
  658. else
  659. if( msgTypeValue == "m" )
  660. onMessage( (ListStrikePrice&)message, sessionID );
  661. else
  662. if( msgTypeValue == "n" )
  663. onMessage( (XMLnonFIX&)message, sessionID );
  664. else
  665. if( msgTypeValue == "o" )
  666. onMessage( (RegistrationInstructions&)message, sessionID );
  667. else
  668. if( msgTypeValue == "p" )
  669. onMessage( (RegistrationInstructionsResponse&)message, sessionID );
  670. else
  671. if( msgTypeValue == "q" )
  672. onMessage( (OrderMassCancelRequest&)message, sessionID );
  673. else
  674. if( msgTypeValue == "r" )
  675. onMessage( (OrderMassCancelReport&)message, sessionID );
  676. else
  677. if( msgTypeValue == "s" )
  678. onMessage( (NewOrderCross&)message, sessionID );
  679. else
  680. if( msgTypeValue == "u" )
  681. onMessage( (CrossOrderCancelRequest&)message, sessionID );
  682. else
  683. if( msgTypeValue == "t" )
  684. onMessage( (CrossOrderCancelReplaceRequest&)message, sessionID );
  685. else
  686. if( msgTypeValue == "v" )
  687. onMessage( (SecurityTypeRequest&)message, sessionID );
  688. else
  689. if( msgTypeValue == "w" )
  690. onMessage( (SecurityTypes&)message, sessionID );
  691. else
  692. if( msgTypeValue == "x" )
  693. onMessage( (SecurityListRequest&)message, sessionID );
  694. else
  695. if( msgTypeValue == "y" )
  696. onMessage( (SecurityList&)message, sessionID );
  697. else
  698. if( msgTypeValue == "z" )
  699. onMessage( (DerivativeSecurityListRequest&)message, sessionID );
  700. else
  701. if( msgTypeValue == "AA" )
  702. onMessage( (DerivativeSecurityList&)message, sessionID );
  703. else
  704. if( msgTypeValue == "AB" )
  705. onMessage( (NewOrderMultileg&)message, sessionID );
  706. else
  707. if( msgTypeValue == "AC" )
  708. onMessage( (MultilegOrderCancelReplaceRequest&)message, sessionID );
  709. else
  710. if( msgTypeValue == "AD" )
  711. onMessage( (TradeCaptureReportRequest&)message, sessionID );
  712. else
  713. if( msgTypeValue == "AE" )
  714. onMessage( (TradeCaptureReport&)message, sessionID );
  715. else
  716. if( msgTypeValue == "AF" )
  717. onMessage( (OrderMassStatusRequest&)message, sessionID );
  718. else
  719. if( msgTypeValue == "AG" )
  720. onMessage( (QuoteRequestReject&)message, sessionID );
  721. else
  722. if( msgTypeValue == "AH" )
  723. onMessage( (RFQRequest&)message, sessionID );
  724. else
  725. if( msgTypeValue == "AI" )
  726. onMessage( (QuoteStatusReport&)message, sessionID );
  727. else onMessage( message, sessionID );
  728. }
  729. };
  730. }
  731. #endif