Files
2024-09-23 12:00:04 -04:00

165 lines
5.3 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
#include <string>
#include <vector>
#include <OnixS/FIXEngine/FIX/Tag.h>
#include <OnixS/FIXEngine/FIX/ProtocolVersion.h>
namespace OnixS {
namespace FIX {
/// Identifies attributes of a valid FIX field value.
class ONIXS_FIXENGINE_API ValidFieldValue
{
public:
/// Returns a valid value of the corresponding FIX field.
std::string value() const;
/// Returns a valid value description of the corresponding FIX field.
std::string description() const;
private:
friend class MessageOperator;
const char * value_;
const char * description_;
ValidFieldValue(const char * value, const char * description);
};
/// Identifies attributes of a FIX field.
class ONIXS_FIXENGINE_API FieldInfo
{
public:
/// Returns the tag number of the corresponding FIX field.
Tag tag() const;
/// Indicates if this field is a required one.
bool isRequired() const;
/// Returns the collection of child fields if this field identifies the repeating group.
std::vector<FieldInfo> childFields() const;
private:
friend class MessageOperator;
const void * impl_;
FieldInfo(const void *);
};
/// Identifies the FIX messages dictionary.
class ONIXS_FIXENGINE_API Dictionary
{
public:
/// Initializes the dictionary according to the
/// definition from the Engine configuration file.
///
/// @param id The identifier of the FIX dictionary as specified in
/// the dictionary XML description by the 'id' attribute of the 'FIX' node.
Dictionary(const char * id);
/// Creates the dictionary that corresponds to
/// the given FIX Protocol version.
Dictionary(ProtocolVersion::Enum version);
/// The dictionary unique identifier.
const std::string & id() const;
/// The version of the FIX messaging specification
/// (protocol) on which the dictionary is based.
ProtocolVersion::Enum version() const;
/// Returns the name of the corresponding FIX field.
///
/// @return The name of corresponding FIX field
/// or an empty string if the field is unknown.
const std::string & fieldName(Tag tag) const;
/// Returns the tag number of the corresponding FIX field.
///
/// @return The tag number of the corresponding FIX field
/// or 0 if the field is unknown.
Tag fieldNumber(const std::string & name) const;
/// Returns the value description (if it exists) of the corresponding FIX field value.
///
/// @return The value description of the corresponding FIX field value
/// or an empty string if there is no a description for this field value
/// or the field is unknown.
std::string fieldValueDescription(Tag tag, const std::string & value) const;
/// The collection of valid field values.
typedef std::vector<ValidFieldValue> ValidFieldValues;
/// Returns valid field values (if they exist) of the corresponding FIX field.
///
/// @return A set of valid field values of the corresponding FIX field value
/// or an empty set if there is no known valid field values for this field
/// or the field is unknown.
ValidFieldValues validFieldValues(Tag tag) const;
/// The collection of message types.
typedef std::vector<std::string> MessageTypes;
/// Returns a collection of types of all messages available in this particular FIX dictionary.
MessageTypes messageTypes() const;
/// Returns the message name by the given message type.
///
/// @return The message name by the given message type
/// or an empty string if the message type is unknown.
std::string messageName(const std::string & type) const;
/// The collection of the FIX field information.
typedef std::vector<FieldInfo> FieldInfos;
/// Returns a collection of field descriptions that belong to the given message.
FieldInfos messageFields(const std::string & type) const;
/// The collection of tag numbers.
typedef std::vector<Tag> Tags;
/// Returns a collection of all tags which belong to the dialect.
Tags tags() const;
/// Compares two dictionaries by their identifiers.
bool operator == (const Dictionary & other) const;
/// Compares two dictionaries by their identifiers.
bool operator != (const Dictionary & other) const;
/// Swaps two instances.
void swap(Dictionary & other);
private:
friend class MessageOperator;
const void * impl_;
Dictionary(const void *);
};
}
}