OnixS C++ FIX Engine  4.2.0
API Documentation
Dictionary.h
Go to the documentation of this file.
1 /*
2 * Copyright Onix Solutions Limited [OnixS]. All rights reserved.
3 *
4 * This software owned by Onix Solutions Limited [OnixS] and is protected by copyright law
5 * and international copyright treaties.
6 *
7 * Access to and use of the software is governed by the terms of the applicable OnixS Software
8 * Services Agreement (the Agreement) and Customer end user license agreements granting
9 * a non-assignable, non-transferable and non-exclusive license to use the software
10 * for it's own data processing purposes under the terms defined in the Agreement.
11 *
12 * Except as otherwise granted within the terms of the Agreement, copying or reproduction of any part
13 * of this source code or associated reference material to any other location for further reproduction
14 * or redistribution, and any amendments to this copyright notice, are expressly prohibited.
15 *
16 * Any reproduction or redistribution for sale or hiring of the Software not in accordance with
17 * the terms of the Agreement is a violation of copyright law.
18 */
19 
20 #pragma once
21 
22 #include <string>
23 #include <vector>
24 
27 
28 namespace OnixS {
29 namespace FIX {
30 /// Identifies attributes of a valid FIX field value.
32 {
33 public:
34  /// Returns a valid value of corresponding FIX field.
35  std::string value() const;
36 
37  /// Returns a valid value description of corresponding FIX field.
38  std::string description() const;
39 
40  ValidFieldValue(const ValidFieldValue & other);
41  ValidFieldValue & operator = (const ValidFieldValue & other);
42 
43 private:
44 
45  friend class MessageOperator;
46 
47  const char * value_;
48  const char * description_;
49 
50  ValidFieldValue(const char * value, const char * description);
51 };
52 
53 /// Identifies attributes of a FIX field.
55 {
56 public:
57  /// Returns the tag number of corresponding FIX field.
58  Tag tag() const;
59 
60  /// Indicates if this field is a required one.
61  bool isRequired() const;
62 
63  /// Returns the collection of child fields if this field identifies the repeating group.
64  std::vector<FieldInfo> childFields() const;
65 
66  FieldInfo(const FieldInfo & other);
67  FieldInfo & operator = (const FieldInfo & other);
68 
69 private:
70 
71  friend class MessageOperator;
72 
73  const void * impl_;
74 
75  FieldInfo(const void *);
76 };
77 
78 /// Identifies FIX messages dictionary.
80 {
81 public:
82  /// Initializes dictionary according to the
83  /// definition from the Engine configuration file.
84  ///
85  /// @param id Identifier of FIX dictionary as specified in
86  /// Dictionary XML description by the 'id' attribute of the 'FIX' node.
87  Dictionary(const char * id);
88 
89  /// Creates the dictionary that corresponds
90  /// the given FIX Protocol version.
92 
93  /// Initializes instance to refer to
94  /// same dictionary as given instance.
95  Dictionary(const Dictionary & other);
96 
97  /// Dictionary unique identifier.
98  const std::string & id() const;
99 
100  /// Version of the FIX messaging specification
101  /// (protocol) on which the dictionary is based.
102  ProtocolVersion::Enum version() const;
103 
104  /// Returns name of corresponding FIX field.
105  ///
106  /// @return name of corresponding FIX field
107  /// or empty string if field is unknown.
108  const std::string & fieldName(Tag tag) const;
109 
110  /// Returns tag number of corresponding FIX field.
111  ///
112  /// @return tag number of corresponding FIX field
113  /// or 0 if field is unknown.
114  Tag fieldNumber(const std::string & name) const;
115 
116  /// Returns value description (if it exists) of corresponding FIX field value.
117  ///
118  /// @return value description of corresponding FIX field value
119  /// or the empty string if there is no a description for this field value
120  /// or the field is unknown.
121  std::string fieldValueDescription(Tag tag, const std::string & value) const;
122 
123  /// Collection of valid field values.
124  typedef std::vector<ValidFieldValue> ValidFieldValues;
125 
126  /// Returns valid field values (if they exist) of corresponding FIX field.
127  ///
128  /// @return a set of valid field values of corresponding FIX field value
129  /// or the empty set if there is no known valid field values for this field
130  /// or the field is unknown.
131  ValidFieldValues validFieldValues(Tag tag) const;
132 
133  /// Collection of message types.
134  typedef std::vector<std::string> MessageTypes;
135 
136  /// Returns a collection of types of all messages available in this particular FIX dictionary.
137  MessageTypes messageTypes() const;
138 
139  /// Returns the message name by the given message type.
140  ///
141  /// @return the message name by the given message type
142  /// or the empty string if the message type is unknown.
143  std::string messageName(const std::string & type) const;
144 
145  /// Collection of FIX field information.
146  typedef std::vector<FieldInfo> FieldInfos;
147 
148  /// Returns a collection of field descriptions that belong to the given message.
149  FieldInfos messageFields(const std::string & type) const;
150 
151  /// Collection of tag numbers.
152  typedef std::vector<Tag> Tags;
153 
154  /// Returns a collection of all tags which belong to the dialect.
155  Tags tags() const;
156 
157  /// Compares two dictionaries by their identifiers.
158  bool operator == (const Dictionary & other) const;
159 
160  /// Compares two dictionaries by their identifiers.
161  bool operator != (const Dictionary & other) const;
162 
163  /// Re-associates instance with another one.
164  Dictionary & operator = (const Dictionary & other);
165 
166  /// Swaps two instances.
167  void swap(Dictionary & other);
168 
169 private:
170  friend class MessageOperator;
171 
172  const void * impl_;
173 
174  Dictionary(const void *);
175 };
176 }
177 }
std::vector< ValidFieldValue > ValidFieldValues
Collection of valid field values.
Definition: Dictionary.h:124
Identifies attributes of a valid FIX field value.
Definition: Dictionary.h:31
Identifies FIX messages dictionary.
Definition: Dictionary.h:79
bool operator!=(const FieldValueRef &ref, const std::string &str)
std::vector< Tag > Tags
Collection of tag numbers.
Definition: Dictionary.h:152
unsigned Tag
Alias for tag numbers.
Definition: Tag.h:27
#define ONIXS_FIXENGINE_API
Definition: ABI.h:45
std::vector< std::string > MessageTypes
Collection of message types.
Definition: Dictionary.h:134
Identifies attributes of a FIX field.
Definition: Dictionary.h:54
std::vector< FieldInfo > FieldInfos
Collection of FIX field information.
Definition: Dictionary.h:146
bool operator==(const FieldValueRef &ref, const std::string &str)