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