58 lines
2.6 KiB
C++
58 lines
2.6 KiB
C++
/*
|
|
* Copyright Onix Solutions Limited [OnixS]. All rights reserved.
|
|
*
|
|
* This software owned by Onix Solutions Limited [OnixS] and is protected by copyright law
|
|
* and international copyright treaties.
|
|
*
|
|
* Access to and use of the software is governed by the terms of the applicable OnixS Software
|
|
* Services Agreement (the Agreement) and Customer end user license agreements granting
|
|
* a non-assignable, non-transferable and non-exclusive license to use the software
|
|
* for it's own data processing purposes under the terms defined in the Agreement.
|
|
*
|
|
* Except as otherwise granted within the terms of the Agreement, copying or reproduction of any part
|
|
* of this source code or associated reference material to any other location for further reproduction
|
|
* or redistribution, and any amendments to this copyright notice, are expressly prohibited.
|
|
*
|
|
* Any reproduction or redistribution for sale or hiring of the Software not in accordance with
|
|
* the terms of the Agreement is a violation of copyright law.
|
|
*/
|
|
|
|
#pragma once
|
|
|
|
namespace OnixS {
|
|
namespace FIX {
|
|
namespace FAST {
|
|
|
|
/// @brief Characteristics of the input data stream for decoding.
|
|
///
|
|
/// This enumeration allows to setup decoder in dependent-decoding (i.e. @c decodeEachMessageIndependently == false) mode for particular characteristics of the input data stream.
|
|
///
|
|
/// The `CompleteMessagesOnly` allows to perform decoding faster, but requires explicit call of Decoder::reset when someone error occurs or
|
|
/// Decoder::decode returns NULL. Decoder::decode() will fire exception if such reset was omitted after exception.
|
|
///
|
|
/// This commonly prohibits usage of the mode for decoding streaming data like TCP/IP stream. On another hand the mode is highly recommended for the data distributed via
|
|
/// UDP multicast or other packet transport which requires reset of decoder at someone strongly determined points.
|
|
///
|
|
/// The `CouldContainPartialMessages` initiates a bit slower decoding then the `CompleteMessagesOnly` but could be used for stream data decoding using following method:
|
|
///
|
|
/// Decoder decoder(templates, dictionary, false, InputDataTraits::CouldContainPartialMessages);
|
|
/// ...
|
|
/// const Message *message = 0;
|
|
/// while(!message) {
|
|
/// /* consume some data */
|
|
/// decoder.tryDecode(buffer, offset, count, &message, &numberOfDecodedBytes);
|
|
/// }
|
|
///
|
|
struct InputDataTraits {
|
|
enum Enum {
|
|
/// Faster decoding but requires explicit decoder reset when error occurs.
|
|
CompleteMessagesOnly = 0,
|
|
|
|
/// Slower decoding, allows to try to decode incomplete messages as well as handling of wrong/damaged data without subsequent explicit reset.
|
|
CouldContainPartialMessages = 1
|
|
};
|
|
};
|
|
}
|
|
}
|
|
}
|