void Reporter::printErrors(std::ostream& os, Errors& errors, const int verbose) { StrStream strstream; strstream << "Summary:"; // Parsing (not really errors) if (unlikely(errors.commentedLines)) { strstream << "\n [" << errors.commentedLines << "] commented lines"; } if (unlikely(errors.blankLines)) { strstream << "\n [" << errors.blankLines << "] blank lines"; } auto nbErrors = errors.nbErrors(); if (unlikely(nbErrors > 0)) { strstream << "\nFound " << nbErrors << " error:"; // Parsing if (unlikely(errors.corruptedMessages)) { strstream << "\n [" << errors.corruptedMessages << "] corrupted messages"; } if (unlikely(errors.IncompleteMessages)) { strstream << "\n [" << errors.IncompleteMessages << "] incomplete messages"; } if (unlikely(errors.wrongActions)) { strstream << "\n [" << errors.wrongActions << "] wrong actions"; } if (unlikely(errors.wrongSides)) { strstream << "\n [" << errors.wrongSides << "] wrong sides"; } if (unlikely(errors.negativeOrderIds)) { strstream << "\n [" << errors.negativeOrderIds << "] negative orderIds"; } if (unlikely(errors.negativeQuantities)) { strstream << "\n [" << errors.negativeQuantities << "] negative quantities"; } if (unlikely(errors.negativePrices)) { strstream << "\n [" << errors.negativePrices << "] negative prices"; } if (unlikely(errors.missingActions)) { strstream << "\n [" << errors.missingActions << "] missing actions"; } if (unlikely(errors.missingOrderIds)) { strstream << "\n [" << errors.missingOrderIds << "] missing orderIds"; } if (unlikely(errors.missingSides)) { strstream << "\n [" << errors.missingSides << "] missing sides"; } if (unlikely(errors.missingQuantities)) { strstream << "\n [" << errors.missingQuantities << "] missing quantities"; } if (unlikely(errors.missingPrices)) { strstream << "\n [" << errors.missingPrices << "] missing prices"; } if (unlikely(errors.zeroOrderIds)) { strstream << "\n [" << errors.zeroOrderIds << "] zero orderIds"; } if (unlikely(errors.zeroQuantities)) { strstream << "\n [" << errors.zeroQuantities << "] zero quantities"; } if (unlikely(errors.zeroPrices)) { strstream << "\n [" << errors.zeroPrices << "] zero prices"; } if (unlikely(errors.outOfBoundsOrderIds)) { strstream << "\n [" << errors.outOfBoundsOrderIds << "] out of bounds orderIds"; } if (unlikely(errors.outOfBoundsQuantities)) { strstream << "\n [" << errors.outOfBoundsQuantities << "] out of bounds quantities"; } if (unlikely(errors.outOfBoundsPrices)) { strstream << "\n [" << errors.outOfBoundsPrices << "] out of bounds prices"; } // Order Management if (unlikely(errors.duplicateOrderIds)) { strstream << "\n [" << errors.duplicateOrderIds << "] duplicate OrderIds"; } if (unlikely(errors.modifiesWithUnknownOrderId)) { strstream << "\n [" << errors.modifiesWithUnknownOrderId << "] modifies with unknown OrderIds"; } if (unlikely(errors.modifiesNotMatchedPrice)) { strstream << "\n [" << errors.modifiesNotMatchedPrice << "] modifies with not matched order price"; } if (unlikely(errors.cancelsWithUnknownOrderId)) { strstream << "\n [" << errors.cancelsWithUnknownOrderId << "] cancels with unknown OrderIds"; } if (unlikely(errors.cancelsNotMatchedQtyOrPrice)) { strstream << "\n [" << errors.cancelsNotMatchedQtyOrPrice << "] cancels with not matched order price"; } if (unlikely(errors.bestBidEqualOrUpperThanBestAsk)) { strstream << "\n [" << errors.bestBidEqualOrUpperThanBestAsk << "] best bid equal or upper than best ask"; } } else { strstream << "\nNo error found"; } auto nbCriticalErrors = errors.nbCriticalErrors(); if (unlikely(nbCriticalErrors > 0)) { strstream << "\nFound [" << nbCriticalErrors << "] critical error:"; if (unlikely(errors.modifiesLimitQtyTooLow)) { strstream << "\n [" << errors.modifiesLimitQtyTooLow << "] modifies with limit quantity too low"; } if (unlikely(errors.modifiesLimitNotFound)) { strstream << "\n [" << errors.modifiesLimitNotFound << "] modifies limit not found"; } if (unlikely(errors.cancelsLimitQtyTooLow)) { strstream << "\n [" << errors.cancelsLimitQtyTooLow << "] cancels with limit quantity too low"; } if (unlikely(errors.cancelsLimitNotFound)) { strstream << "\n [" << errors.cancelsLimitNotFound << "] cancels limit not found"; } } else { strstream << "\nNo critical error found"; } strstream << '\n'; if (unlikely(verbose)) strstream << "Summary length: " << strstream.length() << '\n'; os.rdbuf()->sputn(strstream.c_str(), strstream.length()); os.flush(); }