OnixS C++ FIX Engine  4.8.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 
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 (tag and a reference to a value).
36  /// Field tag.
38 
39  /// Field value reference.
41 
42  /// Initializes 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 /// Ordered collection of fields.
56 typedef
57 std::vector<Field>
59 
60 /// Encapsulates primary operations over collection of FIX
61 /// fields like FIX message and repeating group instance are.
63 {
64 public:
65  /// Indicates whether instance refers to a valid set of fields.
66  ///
67  /// If 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 field-set contains the
72  /// field with the given tag, otherwise - 'false'.
73  ///
74  /// @warning Due to performance considerations, doesn't
75  /// check whether instance refers to a valid set of fields.
76  /// Use OnixS::FIX::FieldSet::valid() to check whether
77  /// instance is in valid state.
78  bool contain(Tag tag) const;
79 
80  /// Returns reference to a given field value.
81  ///
82  /// @warning Due to performance considerations, doesn't
83  /// check whether instance refers to a valid set of fields.
84  /// Use OnixS::FIX::FieldSet::valid() to check whether
85  /// instance is in valid state.
86  FieldValueRef get(Tag tag) const;
87 
88  /// Returns field value as an OnixS::FIX::Char value.
89  ///
90  /// @throw std::exception if conversion is impossible.
91  ///
92  /// @warning Due to performance considerations, doesn't
93  /// check whether instance refers to a valid set of fields.
94  /// Use OnixS::FIX::FieldSet::valid() to check whether
95  /// instance is in valid state.
96  Char getChar(Tag tag) const;
97 
98  /// Returns field value as an OnixS::FIX::Int32 value.
99  ///
100  /// @throw std::exception if conversion is impossible.
101  ///
102  /// @warning Due to performance considerations, doesn't
103  /// check whether instance refers to a valid set of fields.
104  /// Use OnixS::FIX::FieldSet::valid() to check whether
105  /// instance is in valid state.
106  Int32 getInt32(Tag tag) const;
107 
108  /// Returns field value as an OnixS::FIX::UInt32 value.
109  ///
110  /// @throw std::exception if conversion is impossible.
111  ///
112  /// @warning Due to performance considerations, doesn't
113  /// check whether instance refers to a valid set of fields.
114  /// Use OnixS::FIX::FieldSet::valid() to check whether
115  /// instance is in valid state.
116  UInt32 getUInt32(Tag tag) const;
117 
118  /// Returns field value as an OnixS::FIX::Int64 value.
119  ///
120  /// @throw std::exception if conversion is impossible.
121  ///
122  /// @warning Due to performance considerations, doesn't
123  /// check whether instance refers to a valid set of fields.
124  /// Use OnixS::FIX::FieldSet::valid() to check whether
125  /// instance is in valid state.
126  Int64 getInt64(Tag tag) const;
127 
128  /// Returns field value as an OnixS::FIX::UInt64 value.
129  ///
130  /// @throw std::exception if conversion is impossible.
131  ///
132  /// @warning Due to performance considerations, doesn't
133  /// check whether instance refers to a valid set of fields.
134  /// Use OnixS::FIX::FieldSet::valid() to check whether
135  /// instance is in 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 conversion is impossible.
141  ///
142  /// @warning Due to performance considerations, doesn't
143  /// check whether instance refers to a valid set of fields.
144  /// Use OnixS::FIX::FieldSet::valid() to check whether
145  /// instance is in valid state.
146  Double getDouble(Tag tag) const;
147 
148  /// Returns the field value as a decimal number.
149  ///
150  /// @throw std::exception if conversion is impossible.
151  ///
152  /// @warning Due to performance considerations, doesn't
153  /// check whether instance refers to a valid set of fields.
154  /// Use OnixS::FIX::FieldSet::valid() to check whether
155  /// instance is in 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 conversion is impossible.
161  ///
162  /// @warning Due to performance considerations, doesn't
163  /// check whether instance refers to a valid set of fields.
164  /// Use OnixS::FIX::FieldSet::valid() to check whether
165  /// instance is in 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 conversion is impossible.
171  ///
172  /// @warning Due to performance considerations, doesn't
173  /// check whether instance refers to a valid set of fields.
174  /// Use OnixS::FIX::FieldSet::valid() to check whether
175  /// instance is in valid state.
176  StringRef getStringRef(Tag tag) const;
177 
178  /// Returns the field value as a timestamp.
179  ///
180  /// @throw std::exception if 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 instance refers to a valid set of fields.
189  /// Use OnixS::FIX::FieldSet::valid() to check whether
190  /// instance is in 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 conversion is impossible.
196  ///
197  /// @warning Due to performance considerations, doesn't
198  /// check whether instance refers to a valid set of fields.
199  /// Use OnixS::FIX::FieldSet::valid() to check whether
200  /// instance is in 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 conversion is impossible.
206  ///
207  /// @warning Due to performance considerations, doesn't
208  /// check whether instance refers to a valid set of fields.
209  /// Use OnixS::FIX::FieldSet::valid() to check whether
210  /// instance is in valid state.
211  TimeSpan getTimeSpan(Tag tag) const;
212 
213  /// Returns reference to a repeating group if underlying
214  /// field defines length of repeating group.
215  ///
216  /// @param numberOfInstancesTag 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 given field (tag).
222  ///
223  /// @warning Returned instance remains valid until 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 instance refers to a valid set of fields.
232  /// Use OnixS::FIX::FieldSet::valid() to check whether
233  /// instance is in valid state.
234  bool hasFlag(Tag tag) const;
235 
236  /// Assigns given value to the field.
237  ///
238  /// Transforms input value into text-presentation,
239  /// so actually stored value is text-presentation of input.
240  /// Further, stored text-presentation may be directly accessed
241  /// using 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 field of given tag is not defined by the
247  /// FIX Specification for given field set (either message or
248  /// repeating group instance), 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 given value to the field.
254  ///
255  /// Saves value being set as it is without transforming
256  /// it into text-presentation. Assigning 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 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 field of given tag is not defined by the
265  /// FIX Specification for given field set (either message or
266  /// repeating group instance), 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 given value to the field.
272  ///
273  /// Transforms input value into text-presentation,
274  /// so actually stored value is text-presentation of input.
275  /// Further, stored text-presentation may be directly accessed
276  /// using 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 field of given tag is not defined by the
282  /// FIX Specification for given field set (either message or
283  /// repeating group instance), 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 given value to the field.
289  ///
290  /// Saves value being set as it is without transforming
291  /// it into text-presentation. Assigning 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 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 field of given tag is not defined by the
300  /// FIX Specification for given field set (either message or
301  /// repeating group instance), 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 given value to the field.
307  ///
308  /// Transforms input value into text-presentation,
309  /// so actually stored value is text-presentation of input.
310  /// Further, stored text-presentation may be directly accessed
311  /// using 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 field of given tag is not defined by the
317  /// FIX Specification for given field set (either message or
318  /// repeating group instance), 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 given value to the field.
324  ///
325  /// Saves value being set as it is without transforming
326  /// it into text-presentation. Assigning 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 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 field of given tag is not defined by the
335  /// FIX Specification for given field set (either message or
336  /// repeating group instance), 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 given value to the field.
342  ///
343  /// Transforms input value into text-presentation,
344  /// so actually stored value is text-presentation of input.
345  /// Further, stored text-presentation may be directly accessed
346  /// using 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 field of given tag is not defined by the
352  /// FIX Specification for given field set (either message or
353  /// repeating group instance), 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 given value to the field.
359  ///
360  /// Saves value being set as it is without transforming
361  /// it into text-presentation. Assigning 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 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 field of given tag is not defined by the
370  /// FIX Specification for given field set (either message or
371  /// repeating group instance), 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 given value to the field.
377  ///
378  /// Transforms input value into text-presentation,
379  /// so actually stored value is text-presentation of input.
380  /// Further, stored text-presentation may be directly accessed
381  /// using 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 field of given tag is not defined by the
387  /// FIX Specification for given field set (either message or
388  /// repeating group instance), 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 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 input value into text-presentation,
399  /// so actually stored value is text-presentation of input.
400  /// Further, stored text-presentation may be directly accessed
401  /// using 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 field of given tag is not defined by the
407  /// FIX Specification for given field set (either message or
408  /// repeating group instance), 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 given value to the field.
414  ///
415  /// Saves value being set as it is without transforming
416  /// it into text-presentation. Assigning 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 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 field of given tag is not defined by the
425  /// FIX Specification for given field set (either message or
426  /// repeating group instance), 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 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 value being set as it is without transforming
437  /// it into text-presentation. Assigning 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 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 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  FieldSet & 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 the reference to itself for the method chaining approach.
461  ///
462  /// @warning if field of given tag is not defined by the
463  /// FIX Specification for given field set (either message or
464  /// repeating group instance), 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 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 input value into text-presentation,
475  /// so actually stored value is text-presentation of input.
476  /// Further, stored text-presentation may be directly accessed
477  /// using 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 field of given tag is not defined by the
483  /// FIX Specification for given field set (either message or
484  /// repeating group instance), 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 given value to the field.
490  ///
491  /// Saves value being set as it is without transforming
492  /// it into text-presentation. Assigning 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 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 field of given tag is not defined by the
501  /// FIX Specification for given field set (either message or
502  /// repeating group instance), 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 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 value being set as it is without transforming
513  /// it into text-presentation. Assigning 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 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 field of given tag is not defined by the
522  /// FIX Specification for given field set (either message or
523  /// repeating group instance), 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 given value to the field.
529  ///
530  /// @return the reference to itself for the method chaining approach.
531  ///
532  /// @warning if field of given tag is not defined by the
533  /// FIX Specification for given field set (either message or
534  /// repeating group instance), 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 given value to the field.
540  ///
541  /// Stored value represents a copy of input.
542  ///
543  /// @return the reference to itself for the method chaining approach.
544  ///
545  /// @warning if field of given tag is not defined by the
546  /// FIX Specification for given field set (either message or
547  /// repeating group instance), 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 given value to the field.
553  ///
554  /// Stored value represents a copy of input.
555  ///
556  /// @return the reference to itself for the method chaining approach.
557  ///
558  /// @warning if field of given tag is not defined by the
559  /// FIX Specification for given field set (either message or
560  /// repeating group instance), 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 given value to the field.
566  ///
567  /// Stored value represents a copy of input.
568  ///
569  /// @return the reference to itself for the method chaining approach.
570  ///
571  /// @warning if field of given tag is not defined by the
572  /// FIX Specification for given field set (either message or
573  /// repeating group instance), 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 given value to the field.
579  ///
580  /// Transforms input value into text-presentation,
581  /// so actually stored value is text-presentation of input.
582  /// Further, stored text-presentation may be directly accessed
583  /// using 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 field of given tag is not defined by the
589  /// FIX Specification for given field set (either message or
590  /// repeating group instance), 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 given value to the field.
601  ///
602  /// Saves value being set as it is without transforming
603  /// it into text-presentation. Assigning 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 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 field of given tag is not defined by the
612  /// FIX Specification for given field set (either message or
613  /// repeating group instance), 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 given value to the field.
624  ///
625  /// Transforms input value into text-presentation,
626  /// so actually stored value is text-presentation of input.
627  /// Further, stored text-presentation may be directly accessed
628  /// using 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 field of given tag is not defined by the
634  /// FIX Specification for given field set (either message or
635  /// repeating group instance), 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 given value to the field.
646  ///
647  /// Saves value being set as it is without transforming
648  /// it into text-presentation. Assigning 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 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 field of given tag is not defined by the
657  /// FIX Specification for given field set (either message or
658  /// repeating group instance), 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 Tag number of the field that defines
672  /// the number of instances in this repeating group (the NoXXX field).
673  ///
674  /// @param value Number of instances in the repeating group.
675  ///
676  /// @throw std::exception if given field doesn't
677  /// define number of repeating group instances.
678  Group setGroup(Tag tag, size_t value);
679 
680  /// Assigns flag value ("Y" or "N") to the field.
681  ///
682  /// @return the reference to itself for the method chaining approach.
683  ///
684  /// @warning if field of given tag is not defined by the
685  /// FIX Specification for given field set (either message or
686  /// repeating group instance), 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 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 field of given tag is not defined by the
696  /// FIX Specification for given field set (either message or
697  /// repeating group instance), 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 association of field with its value.
703  /// @return 'true' if field had 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 Object to receive the @c FieldSet content.
708  /// @return Number of fields placed to the @c fields vector.
709  size_t fields(Fields & fields) const;
710 
711  /// 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 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  /// FieldSet instance to iterate.
740  const FieldSet * container_;
741 
742  /// 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 field access.
754  typedef size_t AccessPolicies;
755 
756  // Underlying implementation.
757  void * impl_;
758 
759  // Message to which given set belongs to.
761 
762  // Policies to control field access.
763  AccessPolicies policies_;
764 
765  // Uninitialized set.
766  FieldSet();
767 
768  // Uninitialized set.
769  FieldSet(const Message *, void *, AccessPolicies);
770 
771  // Clone construction.
772  FieldSet(const FieldSet &);
773 
774  // 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 time span in "HH:MM:SS.sssssssss" format.
Definition: TimeSpan.h:85
Single instance of FIX Repeating Group.
Definition: Group.h:37
Indicates timestamp in "YYYYMMDD-HH:MM:SS.sssssssss" format.
Definition: Timestamp.h:83
Encapsulates primary operations over collection of FIX fields like FIX message and repeating group in...
Definition: FieldSet.h:62
unsigned int UInt32
Definition: Numeric.h:36
long long Int64
Definition: Numeric.h:38
Encapsulates operations over FIX Repeating Group.
Definition: Group.h:107
#define ONIXS_FIXENGINE_DEFAULT
Definition: Compiler.h:176
FieldValueRef value
Field value reference.
Definition: FieldSet.h:40
#define ONIXS_FIXENGINE_API
Definition: ABI.h:45
const Message * container_
Definition: FieldSet.h:760
Implements concept of a read-only reference to a FIX field value.
Definition: FieldValueRef.h:32
Provides efficient way of accessing text-based FIX field values.
Definition: StringRef.h:58
int Int32
Definition: Numeric.h:35
std::forward_iterator_tag iterator_category
Definition: FieldSet.h:716
Field()
Initializes 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
Time span related functionality.
Definition: TimeSpan.h:93
Field primary attributes (tag and a reference to a value).
Definition: FieldSet.h:35
bool operator==(const FieldValueRef &ref, const std::string &str)
Decimal type for better precision.
Definition: Numeric.h:47
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
Ordered collection of fields.
Definition: FieldSet.h:58
Tag tag
Field tag.
Definition: FieldSet.h:37
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)