OnixS C++ FIX Engine  4.10.1
API Documentation
FieldSet.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 <vector>
23 #include <iterator>
24 
28 
29 namespace OnixS {
30 namespace FIX {
31 ONIXS_FIXENGINE_API_DECL(class, Group);
32 ONIXS_FIXENGINE_API_DECL(class, Message);
33 
34 /// Field primary attributes (the tag and a reference to a value).
36  /// The field tag.
38 
39  /// The field value reference.
41 
42  /// Initializes the field which refers to nothing.
44  : tag(0) {
45  }
46 
47  /// Initializes all members.
49  Tag fieldTag,
50  const FieldValueRef & fieldValue)
51  : tag(fieldTag), value(fieldValue) {
52  }
53 };
54 
55 /// The ordered collection of fields.
56 typedef
57 std::vector<Field>
59 
60 /// Encapsulates primary operations over the collection of FIX
61 /// fields like a FIX message and a repeating group instance are.
63 {
64 public:
65  /// Indicates whether an instance refers to a valid set of fields.
66  ///
67  /// If the given instance doesn't refer to a valid fields set,
68  /// none of other members must be used.
69  bool valid() const;
70 
71  /// Returns 'true' if the field-set contains the
72  /// field with the given tag, otherwise - 'false'.
73  ///
74  /// @warning Due to performance considerations, doesn't
75  /// check whether an instance refers to a valid set of fields.
76  /// Use OnixS::FIX::FieldSet::valid() to check whether
77  /// an instance is in the valid state.
78  bool contain(Tag tag) const;
79 
80  /// Returns a reference to the given field value.
81  ///
82  /// @warning Due to performance considerations, doesn't
83  /// check whether an instance refers to a valid set of fields.
84  /// Use OnixS::FIX::FieldSet::valid() to check whether
85  /// an instance is in the valid state.
86  FieldValueRef get(Tag tag) const;
87 
88  /// Returns a field value as an OnixS::FIX::Char value.
89  ///
90  /// @throw std::exception if the conversion is impossible.
91  ///
92  /// @warning Due to performance considerations, doesn't
93  /// check whether an instance refers to a valid set of fields.
94  /// Use OnixS::FIX::FieldSet::valid() to check whether
95  /// an instance is in the valid state.
96  Char getChar(Tag tag) const;
97 
98  /// Returns a field value as an OnixS::FIX::Int32 value.
99  ///
100  /// @throw std::exception if the conversion is impossible.
101  ///
102  /// @warning Due to performance considerations, doesn't
103  /// check whether an instance refers to a valid set of fields.
104  /// Use OnixS::FIX::FieldSet::valid() to check whether
105  /// an instance is in the valid state.
106  Int32 getInt32(Tag tag) const;
107 
108  /// Returns a field value as an OnixS::FIX::UInt32 value.
109  ///
110  /// @throw std::exception if the conversion is impossible.
111  ///
112  /// @warning Due to performance considerations, doesn't
113  /// check whether an instance refers to a valid set of fields.
114  /// Use OnixS::FIX::FieldSet::valid() to check whether
115  /// an instance is in the valid state.
116  UInt32 getUInt32(Tag tag) const;
117 
118  /// Returns a field value as an OnixS::FIX::Int64 value.
119  ///
120  /// @throw std::exception if the conversion is impossible.
121  ///
122  /// @warning Due to performance considerations, doesn't
123  /// check whether an instance refers to a valid set of fields.
124  /// Use OnixS::FIX::FieldSet::valid() to check whether
125  /// an instance is in the valid state.
126  Int64 getInt64(Tag tag) const;
127 
128  /// Returns a field value as an OnixS::FIX::UInt64 value.
129  ///
130  /// @throw std::exception if the conversion is impossible.
131  ///
132  /// @warning Due to performance considerations, doesn't
133  /// check whether an instance refers to a valid set of fields.
134  /// Use OnixS::FIX::FieldSet::valid() to check whether
135  /// an instance is in the valid state.
136  UInt64 getUInt64(Tag tag) const;
137 
138  /// Returns the field value as a floating-point number.
139  ///
140  /// @throw std::exception if the conversion is impossible.
141  ///
142  /// @warning Due to performance considerations, doesn't
143  /// check whether an instance refers to a valid set of fields.
144  /// Use OnixS::FIX::FieldSet::valid() to check whether
145  /// an instance is in the valid state.
146  Double getDouble(Tag tag) const;
147 
148  /// Returns the field value as a decimal number.
149  ///
150  /// @throw std::exception if the conversion is impossible.
151  ///
152  /// @warning Due to performance considerations, doesn't
153  /// check whether an instance refers to a valid set of fields.
154  /// Use OnixS::FIX::FieldSet::valid() to check whether
155  /// an instance is in the valid state.
156  Decimal getDecimal(Tag tag) const;
157 
158  /// Returns the field value as a decimal number with fixed exponent.
159  ///
160  /// @throw std::exception if the conversion is impossible.
161  ///
162  /// @warning Due to performance considerations, doesn't
163  /// check whether an instance refers to a valid set of fields.
164  /// Use OnixS::FIX::FieldSet::valid() to check whether
165  /// an instance is in the valid state.
166  Decimal getDecimal(Tag tag, Int32 exponent) const;
167 
168  /// Returns reference to a read-only text chain.
169  ///
170  /// @throw std::exception if the conversion is impossible.
171  ///
172  /// @warning Due to performance considerations, doesn't
173  /// check whether an instance refers to a valid set of fields.
174  /// Use OnixS::FIX::FieldSet::valid() to check whether
175  /// an instance is in the valid state.
176  StringRef getStringRef(Tag tag) const;
177 
178  /// Returns the field value as a timestamp.
179  ///
180  /// @throw std::exception if the conversion is impossible.
181  ///
182  /// The method tries to determine the timestamp format in runtime.
183  /// Therefore, it makes sense to use this method when the timestamp format
184  /// is unknown. Otherwise, for better performance, the overloaded method
185  /// with the explicit timestamp format parameter should be used.
186  ///
187  /// @warning Due to performance considerations, doesn't
188  /// check whether an instance refers to a valid set of fields.
189  /// Use OnixS::FIX::FieldSet::valid() to check whether
190  /// an instance is in the valid state.
191  Timestamp getTimestamp(Tag tag) const;
192 
193  /// Returns the field value as a timestamp of the requested format.
194  ///
195  /// @throw std::exception if the conversion is impossible.
196  ///
197  /// @warning Due to performance considerations, doesn't
198  /// check whether an instance refers to a valid set of fields.
199  /// Use OnixS::FIX::FieldSet::valid() to check whether
200  /// an instance is in the valid state.
201  Timestamp getTimestamp(Tag tag, TimestampFormat::Enum) const;
202 
203  /// Returns the field value as a time span.
204  ///
205  /// @throw std::exception if the conversion is impossible.
206  ///
207  /// @warning Due to performance considerations, doesn't
208  /// check whether an instance refers to a valid set of fields.
209  /// Use OnixS::FIX::FieldSet::valid() to check whether
210  /// an instance is in the valid state.
211  TimeSpan getTimeSpan(Tag tag) const;
212 
213  /// Returns a reference to a repeating group if the underlying
214  /// field defines the length of the repeating group.
215  ///
216  /// @param numberOfInstancesTag The Tag number of
217  /// the field that defines the number of instances
218  /// in this repeating group (the NoXXX field).
219  ///
220  /// @throw std::exception if no repeating group
221  /// is associated with the given field (tag).
222  ///
223  /// @warning The returned instance remains valid until the field is
224  /// modified via any of OnixS::FIX::FieldSet::set members.
225  Group getGroup(Tag numberOfInstancesTag) const;
226 
227  /// Returns true if the given flag is present
228  /// and it equals to "Y", otherwise false.
229  ///
230  /// @warning Due to performance considerations, doesn't
231  /// check whether an instance refers to a valid set of fields.
232  /// Use OnixS::FIX::FieldSet::valid() to check whether
233  /// an instance is in the valid state.
234  bool hasFlag(Tag tag) const;
235 
236  /// Assigns the given value to the field.
237  ///
238  /// Transforms the input value into the text-presentation,
239  /// so actually stored value is the text-presentation of the input.
240  /// Further, the stored text-presentation may be directly accessed
241  /// using the OnixS::FIX::FieldSet::getStringRef() member to avoid
242  /// additional memory allocations and copying.
243  ///
244  /// @return the reference to itself for the method chaining approach.
245  ///
246  /// @warning if the field of the given tag is not defined by the
247  /// FIX Specification for the given field set (either a message or
248  /// a repeating group instance), the function may throw an exception
249  /// (behavior is controlled by validation-related parameters
250  /// from the Engine's configuration).
251  FieldSet & set(Tag tag, Int32 value);
252 
253  /// Assigns the given value to the field.
254  ///
255  /// Saves the value being set as it is without transforming
256  /// it into the text-presentation. Assigning the field value via
257  /// OnixS::FIX::FieldSet::setV members saves not only value
258  /// but it's type as well, therefore no parsing is performed
259  /// during the subsequent access to the field via get&lt;Type&gt;
260  /// member.
261  ///
262  /// @return the reference to itself for the method chaining approach.
263  ///
264  /// @warning if the field of the given tag is not defined by the
265  /// FIX Specification for the given field set (either a message or
266  /// a repeating group instance), the function may throw an exception
267  /// (behavior is controlled by validation-related parameters
268  /// from the Engine's configuration).
269  FieldSet & setV(Tag tag, Int32 value);
270 
271  /// Assigns the given value to the field.
272  ///
273  /// Transforms the input value into the text-presentation,
274  /// so actually stored value is the text-presentation of the input.
275  /// Further, the stored text-presentation may be directly accessed
276  /// using the OnixS::FIX::FieldSet::getStringRef() member to avoid
277  /// additional memory allocations and copying.
278  ///
279  /// @return the reference to itself for the method chaining approach.
280  ///
281  /// @warning if the field of the given tag is not defined by the
282  /// FIX Specification for the given field set (either a message or
283  /// a repeating group instance), the function may throw an exception
284  /// (behavior is controlled by validation-related parameters
285  /// from the Engine's configuration).
286  FieldSet & set(Tag tag, UInt32 value);
287 
288  /// Assigns the given value to the field.
289  ///
290  /// Saves the value being set as it is without transforming
291  /// it into the text-presentation. Assigning the field value via
292  /// OnixS::FIX::FieldSet::setV members saves not only value
293  /// but it's type as well, therefore no parsing is performed
294  /// during the subsequent access to the field via get&lt;Type&gt;
295  /// member.
296  ///
297  /// @return the reference to itself for the method chaining approach.
298  ///
299  /// @warning if the field of the given tag is not defined by the
300  /// FIX Specification for the given field set (either a message or
301  /// a repeating group instance), the function may throw an exception
302  /// (behavior is controlled by validation-related parameters
303  /// from the Engine's configuration).
304  FieldSet & setV(Tag tag, UInt32 value);
305 
306  /// Assigns the given value to the field.
307  ///
308  /// Transforms the input value into the text-presentation,
309  /// so actually stored value is the text-presentation of the input.
310  /// Further, the stored text-presentation may be directly accessed
311  /// using the OnixS::FIX::FieldSet::getStringRef() member to avoid
312  /// additional memory allocations and copying.
313  ///
314  /// @return the reference to itself for the method chaining approach.
315  ///
316  /// @warning if the field of the given tag is not defined by the
317  /// FIX Specification for the given field set (either a message or
318  /// a repeating group instance), the function may throw an exception
319  /// (behavior is controlled by validation-related parameters
320  /// from the Engine's configuration).
321  FieldSet & set(Tag tag, Int64 value);
322 
323  /// Assigns the given value to the field.
324  ///
325  /// Saves the value being set as it is without transforming
326  /// it into the text-presentation. Assigning the field value via
327  /// OnixS::FIX::FieldSet::setV members saves not only value
328  /// but it's type as well, therefore no parsing is performed
329  /// during the subsequent access to the field via get&lt;Type&gt;
330  /// member.
331  ///
332  /// @return the reference to itself for the method chaining approach.
333  ///
334  /// @warning if the field of the given tag is not defined by the
335  /// FIX Specification for the given field set (either a message or
336  /// a repeating group instance), the function may throw an exception
337  /// (behavior is controlled by validation-related parameters
338  /// from the Engine's configuration).
339  FieldSet & setV(Tag tag, Int64 value);
340 
341  /// Assigns the given value to the field.
342  ///
343  /// Transforms the input value into the text-presentation,
344  /// so actually stored value is the text-presentation of the input.
345  /// Further, the stored text-presentation may be directly accessed
346  /// using the OnixS::FIX::FieldSet::getStringRef() member to avoid
347  /// additional memory allocations and copying.
348  ///
349  /// @return the reference to itself for the method chaining approach.
350  ///
351  /// @warning if the field of the given tag is not defined by the
352  /// FIX Specification for the given field set (either a message or
353  /// a repeating group instance), the function may throw an exception
354  /// (behavior is controlled by validation-related parameters
355  /// from the Engine's configuration).
356  FieldSet & set(Tag tag, UInt64 value);
357 
358  /// Assigns the given value to the field.
359  ///
360  /// Saves the value being set as it is without transforming
361  /// it into the text-presentation. Assigning the field value via
362  /// OnixS::FIX::FieldSet::setV members saves not only value
363  /// but it's type as well, therefore no parsing is performed
364  /// during the subsequent access to the field via get&lt;Type&gt;
365  /// member.
366  ///
367  /// @return the reference to itself for the method chaining approach.
368  ///
369  /// @warning if the field of the given tag is not defined by the
370  /// FIX Specification for the given field set (either a message or
371  /// a repeating group instance), the function may throw an exception
372  /// (behavior is controlled by validation-related parameters
373  /// from the Engine's configuration).
374  FieldSet & setV(Tag tag, UInt64 value);
375 
376  /// Assigns the given value to the field.
377  ///
378  /// Transforms the input value into the text-presentation,
379  /// so actually stored value is the text-presentation of the input.
380  /// Further, the stored text-presentation may be directly accessed
381  /// using the OnixS::FIX::FieldSet::getStringRef() member to avoid
382  /// additional memory allocations and copying.
383  ///
384  /// @return the reference to itself for the method chaining approach.
385  ///
386  /// @warning if the field of the given tag is not defined by the
387  /// FIX Specification for the given field set (either a message or
388  /// a repeating group instance), the function may throw an exception
389  /// (behavior is controlled by validation-related parameters
390  /// from the Engine's configuration).
391  FieldSet & set(Tag tag, Double value, size_t precision = 17);
392 
393  /// Assigns the given value to the field,
394  /// if the string presentation of the value is greater than
395  /// the length it will be truncated, only digit characters
396  /// are counted.
397  ///
398  /// Transforms the input value into the text-presentation,
399  /// so actually stored value is the text-presentation of the input.
400  /// Further, the stored text-presentation may be directly accessed
401  /// using the OnixS::FIX::FieldSet::getStringRef() member to avoid
402  /// additional memory allocations and copying.
403  ///
404  /// @return the reference to itself for the method chaining approach.
405  ///
406  /// @warning if the field of the given tag is not defined by the
407  /// FIX Specification for the given field set (either a message or
408  /// a repeating group instance), the function may throw an exception
409  /// (behavior is controlled by validation-related parameters
410  /// from the Engine's configuration).
411  FieldSet & set(Tag tag, Double value, size_t precision, size_t length);
412 
413  /// Assigns the given value to the field.
414  ///
415  /// Saves the value being set as it is without transforming
416  /// it into the text-presentation. Assigning the field value via
417  /// OnixS::FIX::FieldSet::setV members saves not only value
418  /// but it's type as well, therefore no parsing is performed
419  /// during the subsequent access to the field via get&lt;Type&gt;
420  /// member.
421  ///
422  /// @return the reference to itself for the method chaining approach.
423  ///
424  /// @warning if the field of the given tag is not defined by the
425  /// FIX Specification for the given field set (either a message or
426  /// a repeating group instance), the function may throw an exception
427  /// (behavior is controlled by validation-related parameters
428  /// from the Engine's configuration).
429  FieldSet & setV(Tag tag, Double value, size_t precision = 17);
430 
431  /// Assigns the given value to the field.
432  /// if the string presentation of the value is greater than
433  /// the length it will be truncated, only digit characters
434  /// are counted.
435  ///
436  /// Saves the value being set as it is without transforming
437  /// it into the text-presentation. Assigning the field value via
438  /// OnixS::FIX::FieldSet::setV members saves not only value
439  /// but it's type as well, therefore no parsing is performed
440  /// during the subsequent access to the field via get&lt;Type&gt;
441  /// member.
442  ///
443  /// @return the reference to itself for the method chaining approach.
444  ///
445  /// @warning if the field of the given tag is not defined by the
446  /// FIX Specification for the given field set (either a message or
447  /// a repeating group instance), the function may throw an exception
448  /// (behavior is controlled by validation-related parameters
449  /// from the Engine's configuration).
450  FieldSet & setV(Tag tag, Double value, size_t precision, size_t length);
451 
452  /// Assigns the given value to the field.
453  ///
454  /// Transforms the input value into the text-presentation,
455  /// so actually stored value is the text-presentation of the input.
456  /// Further, the stored text-presentation may be directly accessed
457  /// using the OnixS::FIX::FieldSet::getStringRef() member to avoid
458  /// additional memory allocations and copying.
459  ///
460  /// @return the reference to itself for the method chaining approach.
461  ///
462  /// @warning if the field of the given tag is not defined by the
463  /// FIX Specification for the given field set (either a message or
464  /// a repeating group instance), the function may throw an exception
465  /// (behavior is controlled by validation-related parameters
466  /// from the Engine's configuration).
467  FieldSet & set(Tag tag, const Decimal & value);
468 
469  /// Assigns the given value to the field.
470  /// if the string presentation of the value is greater than
471  /// the length it will be truncated, only digit characters
472  /// are counted.
473  ///
474  /// Transforms the input value into the text-presentation,
475  /// so actually stored value is the text-presentation of the input.
476  /// Further, the stored text-presentation may be directly accessed
477  /// using the OnixS::FIX::FieldSet::getStringRef() member to avoid
478  /// additional memory allocations and copying.
479  ///
480  /// @return the reference to itself for the method chaining approach.
481  ///
482  /// @warning if the field of the given tag is not defined by the
483  /// FIX Specification for the given field set (either a message or
484  /// a repeating group instance), the function may throw an exception
485  /// (behavior is controlled by validation-related parameters
486  /// from the Engine's configuration).
487  FieldSet & set(Tag tag, const Decimal & value, size_t length);
488 
489  /// Assigns the given value to the field.
490  ///
491  /// Saves the value being set as it is without transforming
492  /// it into the text-presentation. Assigning the field value via
493  /// OnixS::FIX::FieldSet::setV members saves not only value
494  /// but it's type as well, therefore no parsing is performed
495  /// during the subsequent access to the field via get&lt;Type&gt;
496  /// member.
497  ///
498  /// @return the reference to itself for the method chaining approach..
499  ///
500  /// @warning if the field of the given tag is not defined by the
501  /// FIX Specification for the given field set (either a message or
502  /// a repeating group instance), the function may throw an exception
503  /// (behavior is controlled by validation-related parameters
504  /// from the Engine's configuration).
505  FieldSet & setV(Tag tag, const Decimal & value);
506 
507  /// Assigns the given value to the field.
508  /// if the string presentation of the value is greater than
509  /// the length it will be truncated, only digit characters
510  /// are counted.
511  ///
512  /// Saves the value being set as it is without transforming
513  /// it into the text-presentation. Assigning the field value via
514  /// OnixS::FIX::FieldSet::setV members saves not only value
515  /// but it's type as well, therefore no parsing is performed
516  /// during the subsequent access to the field via get&lt;Type&gt;
517  /// member.
518  ///
519  /// @return the reference to itself for the method chaining approach.
520  ///
521  /// @warning if the field of the given tag is not defined by the
522  /// FIX Specification for the given field set (either a message or
523  /// a repeating group instance), the function may throw an exception
524  /// (behavior is controlled by validation-related parameters
525  /// from the Engine's configuration).
526  FieldSet & setV(Tag tag, const Decimal & value, size_t length);
527 
528  /// Assigns the given value to the field.
529  ///
530  /// @return the reference to itself for the method chaining approach.
531  ///
532  /// @warning if the field of the given tag is not defined by the
533  /// FIX Specification for the given field set (either a message or
534  /// a repeating group instance), the function may throw an exception
535  /// (behavior is controlled by validation-related parameters
536  /// from the Engine's configuration).
537  FieldSet & set(Tag tag, char value);
538 
539  /// Assigns the given value to the field.
540  ///
541  /// The stored value represents a copy of the input.
542  ///
543  /// @return the reference to itself for the method chaining approach.
544  ///
545  /// @warning if the field of the given tag is not defined by the
546  /// FIX Specification for the given field set (either a message or
547  /// a repeating group instance), the function may throw an exception
548  /// (behavior is controlled by validation-related parameters
549  /// from the Engine's configuration).
550  FieldSet & set(Tag tag, const std::string & value);
551 
552  /// Assigns the given value to the field.
553  ///
554  /// The stored value represents a copy of the input.
555  ///
556  /// @return the reference to itself for the method chaining approach.
557  ///
558  /// @warning if the field of the given tag is not defined by the
559  /// FIX Specification for the given field set (either a message or
560  /// a repeating group instance), the function may throw an exception
561  /// (behavior is controlled by validation-related parameters
562  /// from the Engine's configuration).
563  FieldSet & set(Tag tag, const char * value);
564 
565  /// Assigns the given value to the field.
566  ///
567  /// The stored value represents a copy of the input.
568  ///
569  /// @return the reference to itself for the method chaining approach.
570  ///
571  /// @warning if the field of the given tag is not defined by the
572  /// FIX Specification for the given field set (either a message or
573  /// a repeating group instance), the function may throw an exception
574  /// (behavior is controlled by validation-related parameters
575  /// from the Engine's configuration).
576  FieldSet & set(Tag tag, const StringRef & value);
577 
578  /// Assigns the given value to the field.
579  ///
580  /// Transforms the input value into the text-presentation,
581  /// so actually stored value is the text-presentation of the input.
582  /// Further, the stored text-presentation may be directly accessed
583  /// using the OnixS::FIX::FieldSet::getStringRef() member to avoid
584  /// additional memory allocations and copying.
585  ///
586  /// @return the reference to itself for the method chaining approach.
587  ///
588  /// @warning if the field of the given tag is not defined by the
589  /// FIX Specification for the given field set (either a message or
590  /// a repeating group instance), the function may throw an exception
591  /// (behavior is controlled by validation-related parameters
592  /// from the Engine's configuration).
593  FieldSet &
594  set(
595  Tag tag,
596  const Timestamp & value,
597  TimestampFormat::Enum valueFormat =
599 
600  /// Assigns the given value to the field.
601  ///
602  /// Saves the value being set as it is without transforming
603  /// it into the text-presentation. Assigning the field value via
604  /// OnixS::FIX::FieldSet::setV members saves not only value
605  /// but it's type as well, therefore no parsing is performed
606  /// during the subsequent access to the field via get&lt;Type&gt;
607  /// member.
608  ///
609  /// @return the reference to itself for the method chaining approach.
610  ///
611  /// @warning if the field of the given tag is not defined by the
612  /// FIX Specification for the given field set (either a message or
613  /// a repeating group instance), the function may throw an exception
614  /// (behavior is controlled by validation-related parameters
615  /// from the Engine's configuration).
616  FieldSet &
617  setV(
618  Tag tag,
619  const Timestamp & value,
620  TimestampFormat::Enum valueFormat =
622 
623  /// Assigns the given value to the field.
624  ///
625  /// Transforms the input value into the text-presentation,
626  /// so actually stored value is the text-presentation of the input.
627  /// Further, the stored text-presentation may be directly accessed
628  /// using the OnixS::FIX::FieldSet::getStringRef() member to avoid
629  /// additional memory allocations and copying.
630  ///
631  /// @return the reference to itself for the method chaining approach.
632  ///
633  /// @warning if the field of the given tag is not defined by the
634  /// FIX Specification for the given field set (either a message or
635  /// a repeating group instance), the function may throw an exception
636  /// (behavior is controlled by validation-related parameters
637  /// from the Engine's configuration).
638  FieldSet &
639  set(
640  Tag tag,
641  const TimeSpan & value,
642  TimeSpanFormat::Enum valueFormat =
644 
645  /// Assigns the given value to the field.
646  ///
647  /// Saves the value being set as it is without transforming
648  /// it into the text-presentation. Assigning the field value via
649  /// OnixS::FIX::FieldSet::setV members saves not only value
650  /// but it's type as well, therefore no parsing is performed
651  /// during the subsequent access to the field via get&lt;Type&gt;
652  /// member.
653  ///
654  /// @return the reference to itself for the method chaining approach.
655  ///
656  /// @warning if the field of the given tag is not defined by the
657  /// FIX Specification for the given field set (either a message or
658  /// a repeating group instance), the function may throw an exception
659  /// (behavior is controlled by validation-related parameters
660  /// from the Engine's configuration).
661  FieldSet &
662  setV(
663  Tag tag,
664  const TimeSpan & value,
665  TimeSpanFormat::Enum valueFormat =
667 
668  /// Creates a new repeating group or changes the number
669  /// of instances in the existing repeating group.
670  ///
671  /// @param tag The Tag number of the field that defines
672  /// the number of instances in this repeating group (the NoXXX field).
673  ///
674  /// @param value The number of instances in the repeating group.
675  ///
676  /// @throw std::exception if the given field doesn't
677  /// define the number of repeating group instances.
678  Group setGroup(Tag tag, size_t value);
679 
680  /// Assigns the flag value ("Y" or "N") to the field.
681  ///
682  /// @return the reference to itself for the method chaining approach.
683  ///
684  /// @warning if the field of the given tag is not defined by the
685  /// FIX Specification for the given field set (either a message or
686  /// a repeating group instance), the function may throw an exception
687  /// (behavior is controlled by validation-related parameters
688  /// from the Engine's configuration).
689  FieldSet & setFlag(Tag tag, bool value);
690 
691  /// Assigns the value to a field as a copy of another field value.
692  ///
693  /// @return the reference to itself for the method chaining approach.
694  ///
695  /// @warning if the field of the given tag is not defined by the
696  /// FIX Specification for the given field set (either a message or
697  /// a repeating group instance), the function may throw an exception
698  /// (behavior is controlled by validation-related parameters
699  /// from the Engine's configuration).
700  FieldSet & set(Tag tag, const FieldValueRef & value);
701 
702  /// Erases an association of the field with its value.
703  /// @return 'true' if the field had a valid value before.
704  bool erase(Tag tag);
705 
706  /// Retrieve tags and values of all non-empty fields belonged to the given @c FieldSet instance.
707  /// @param fields The object to receive the @c FieldSet content.
708  /// @return The number of fields placed to the @c fields vector.
709  size_t fields(Fields & fields) const;
710 
711  /// The constant iterator to iterate over all fields in the given FieldSet instance.
713  {
714  public:
715 
716  typedef std::forward_iterator_tag iterator_category;
717  typedef Field value_type;
719  typedef Field * pointer;
720  typedef Field & reference;
721 
722  /// Initializes the iterator by a first field from which you need to iterate.
723  ConstIterator(const FieldSet *, Tag);
724 
725  const Field & operator *() const {
726  return currentField_;
727  }
728 
729  const Field * operator ->() const {
730  return &currentField_;
731  }
732 
733  bool operator == (const ConstIterator &) const;
734  bool operator != (const ConstIterator &) const;
735 
736  ConstIterator & operator ++();
737 
738  private:
739  /// The FieldSet instance to iterate.
740  const FieldSet * container_;
741 
742  /// The current field.
743  Field currentField_;
744  };
745 
746  /// Returns the constant iterator to the first field in the FieldSet instance.
747  ConstIterator begin() const;
748 
749  /// Returns the constant iterator to the field after the last one in the FieldSet instance.
750  ConstIterator end() const;
751 
752 protected:
753  // Policies to control the field access.
754  typedef size_t AccessPolicies;
755 
756  // The underlying implementation.
757  void * impl_;
758 
759  // The message to which the given set belongs to.
761 
762  // Policies to control the field access.
763  AccessPolicies policies_;
764 
765  // The uninitialized set.
766  FieldSet();
767 
768  // The uninitialized set.
769  FieldSet(const Message *, void *, AccessPolicies);
770 
771  // The clone construction.
772  FieldSet(const FieldSet &);
773 
774  // The destruction available via descendants.
776 
777  FieldSet & operator = (const FieldSet &);
778 
779  // Swaps two instances.
780  void swap(FieldSet &);
781 
782 private:
783  friend class Message;
784  friend class GroupInstance;
785  friend class MessageOperator;
786 };
787 
788 inline
789 bool
790 FieldSet::contain(Tag tag) const
791 {
792  return get(tag).valid();
793 }
794 }
795 }
Indicates the time span in the "HH:MM:SS.sssssssss" format.
Definition: TimeSpan.h:85
The single instance of the FIX Repeating Group.
Definition: Group.h:37
Indicates the timestamp in the "YYYYMMDD-HH:MM:SS.sssssssss" format.
Definition: Timestamp.h:83
Encapsulates primary operations over the collection of FIX fields like a FIX message and a repeating ...
Definition: FieldSet.h:62
unsigned int UInt32
Definition: Numeric.h:36
long long Int64
Definition: Numeric.h:38
Encapsulates operations over the FIX Repeating Group.
Definition: Group.h:107
#define ONIXS_FIXENGINE_DEFAULT
Definition: Compiler.h:176
FieldValueRef value
The field value reference.
Definition: FieldSet.h:40
#define ONIXS_FIXENGINE_API
Definition: ABI.h:45
const Message * container_
Definition: FieldSet.h:760
Implements a concept of a read-only reference to a FIX field value.
Definition: FieldValueRef.h:32
Provides an efficient way of accessing text-based FIX field values.
Definition: StringRef.h:59
int Int32
Definition: Numeric.h:35
std::forward_iterator_tag iterator_category
Definition: FieldSet.h:716
Field()
Initializes the field which refers to nothing.
Definition: FieldSet.h:43
unsigned long long UInt64
Definition: Numeric.h:39
ONIXS_FIXENGINE_API_DECL(class, IEngineListener)
AccessPolicies policies_
Definition: FieldSet.h:763
unsigned Tag
Alias for tag numbers.
Definition: Tag.h:28
The time span related functionality.
Definition: TimeSpan.h:93
Field primary attributes (the tag and a reference to a value).
Definition: FieldSet.h:35
bool operator==(const FieldValueRef &ref, const std::string &str)
The Decimal type for a better precision.
Definition: Numeric.h:47
The constant iterator to iterate over all fields in the given FieldSet instance.
Definition: FieldSet.h:712
Encapsulates operations over a FIX Message.
Definition: Message.h:49
std::vector< Field > Fields
The ordered collection of fields.
Definition: FieldSet.h:58
Tag tag
The field tag.
Definition: FieldSet.h:37
The timestamps related functionality.
Definition: Timestamp.h:91
double Double
Definition: Numeric.h:41
Field(Tag fieldTag, const FieldValueRef &fieldValue)
Initializes all members.
Definition: FieldSet.h:48
char Char
Definition: Numeric.h:30
bool operator!=(const FieldValueRef &ref, const std::string &str)