OnixS C++ FIX Engine 4.13.0
API Documentation
Loading...
Searching...
No Matches
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
29namespace OnixS {
30namespace FIX {
33
38
41
44 : tag(0) {
45 }
46
49 Tag fieldTag,
50 const FieldValueRef & fieldValue)
51 : tag(fieldTag), value(fieldValue) {
52 }
53};
54
56typedef
57std::vector<Field>
59
63{
64public:
69 bool valid() const;
70
78 bool contain(Tag tag) const;
79
86 FieldValueRef get(Tag tag) const;
87
96 Char getChar(Tag tag) const;
97
106 Int32 getInt32(Tag tag) const;
107
116 UInt32 getUInt32(Tag tag) const;
117
126 Int64 getInt64(Tag tag) const;
127
136 UInt64 getUInt64(Tag tag) const;
137
146 Double getDouble(Tag tag) const;
147
157
166 Decimal getDecimal(Tag tag, Int32 exponent) const;
167
177
192
202
212
225 Group getGroup(Tag numberOfInstancesTag) const;
226
234 bool hasFlag(Tag tag) const;
235
251 FieldSet & set(Tag tag, Int32 value);
252
269 FieldSet & setV(Tag tag, Int32 value);
270
286 FieldSet & set(Tag tag, UInt32 value);
287
304 FieldSet & setV(Tag tag, UInt32 value);
305
321 FieldSet & set(Tag tag, Int64 value);
322
339 FieldSet & setV(Tag tag, Int64 value);
340
356 FieldSet & set(Tag tag, UInt64 value);
357
374 FieldSet & setV(Tag tag, UInt64 value);
375
391 FieldSet & set(Tag tag, Double value, size_t precision = 17);
392
411 FieldSet & set(Tag tag, Double value, size_t precision, size_t length);
412
429 FieldSet & setV(Tag tag, Double value, size_t precision = 17);
430
450 FieldSet & setV(Tag tag, Double value, size_t precision, size_t length);
451
467 FieldSet & set(Tag tag, const Decimal & value);
468
487 FieldSet & set(Tag tag, const Decimal & value, size_t length);
488
505 FieldSet & setV(Tag tag, const Decimal & value);
506
526 FieldSet & setV(Tag tag, const Decimal & value, size_t length);
527
537 FieldSet & set(Tag tag, char value);
538
550 FieldSet & set(Tag tag, const std::string & value);
551
563 FieldSet & set(Tag tag, const char * value);
564
576 FieldSet & set(Tag tag, const StringRef & value);
577
593 FieldSet &
595 Tag tag,
596 const Timestamp & value,
597 TimestampFormat::Enum valueFormat =
599
616 FieldSet &
618 Tag tag,
619 const Timestamp & value,
620 TimestampFormat::Enum valueFormat =
622
638 FieldSet &
640 Tag tag,
641 const TimeSpan & value,
642 TimeSpanFormat::Enum valueFormat =
644
661 FieldSet &
663 Tag tag,
664 const TimeSpan & value,
665 TimeSpanFormat::Enum valueFormat =
667
678 Group setGroup(Tag tag, size_t value);
679
689 FieldSet & setFlag(Tag tag, bool value);
690
700 FieldSet & set(Tag tag, const FieldValueRef & value);
701
704 bool erase(Tag tag);
705
709 size_t fields(Fields & fields) const;
710
713 {
714 public:
715
716 typedef std::forward_iterator_tag iterator_category;
718 typedef std::ptrdiff_t difference_type;
719 typedef Field * pointer;
720 typedef Field & reference;
721
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:
740 const FieldSet * container_;
741
743 Field currentField_;
744 };
745
748
751
752protected:
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.
764
765 // The uninitialized set.
767
768 // The uninitialized set.
769 FieldSet(const Message *, void *, AccessPolicies);
770
771 // The clone construction.
773
774 // The destruction available via descendants.
776
777 FieldSet & operator = (const FieldSet &);
778
779 // Swaps two instances.
780 void swap(FieldSet &);
781
782private:
783 friend class Message;
784 friend class GroupInstance;
785 friend class MessageOperator;
786};
787
788inline
789bool
791{
792 return get(tag).valid();
793}
794}
795}
#define ONIXS_FIXENGINE_API_DECL(typeKind, typeName)
Definition ABI.h:57
#define ONIXS_FIXENGINE_API
Definition ABI.h:45
#define ONIXS_FIXENGINE_DEFAULT
Definition Compiler.h:194
The Decimal type for a better precision.
Definition Numeric.h:48
The constant iterator to iterate over all fields in the given FieldSet instance.
Definition FieldSet.h:713
std::forward_iterator_tag iterator_category
Definition FieldSet.h:716
ConstIterator(const FieldSet *, Tag)
Initializes the iterator by a first field from which you need to iterate.
FieldSet & setV(Tag tag, Double value, size_t precision, size_t length)
Assigns the given value to the field.
UInt32 getUInt32(Tag tag) const
Returns a field value as an OnixS::FIX::UInt32 value.
FieldSet & setV(Tag tag, Int64 value)
Assigns the given value to the field.
FieldSet & set(Tag tag, Double value, size_t precision, size_t length)
Assigns the given value to the field, if the string presentation of the value is greater than the len...
FieldSet & set(Tag tag, const Timestamp &value, TimestampFormat::Enum valueFormat=TimestampFormat::YYYYMMDDHHMMSSNsec)
Assigns the given value to the field.
Timestamp getTimestamp(Tag tag) const
Returns the field value as a timestamp.
Timestamp getTimestamp(Tag tag, TimestampFormat::Enum) const
Returns the field value as a timestamp of the requested format.
FieldSet(const Message *, void *, AccessPolicies)
const Message * container_
Definition FieldSet.h:760
bool valid() const
Indicates whether an instance refers to a valid set of fields.
FieldSet & set(Tag tag, const FieldValueRef &value)
Assigns the value to a field as a copy of another field value.
Int32 getInt32(Tag tag) const
Returns a field value as an OnixS::FIX::Int32 value.
bool hasFlag(Tag tag) const
Returns true if the given flag is present and it equals to "Y", otherwise false.
FieldSet & setV(Tag tag, UInt32 value)
Assigns the given value to the field.
void swap(FieldSet &)
FieldSet & set(Tag tag, UInt64 value)
Assigns the given value to the field.
FieldSet & setV(Tag tag, const Decimal &value, size_t length)
Assigns the given value to the field.
Double getDouble(Tag tag) const
Returns the field value as a floating-point number.
FieldSet & set(Tag tag, UInt32 value)
Assigns the given value to the field.
FieldSet(const FieldSet &)
Group getGroup(Tag numberOfInstancesTag) const
Returns a reference to a repeating group if the underlying field defines the length of the repeating ...
friend class Message
Definition FieldSet.h:783
ConstIterator end() const
Returns the constant iterator to the field after the last one in the FieldSet instance.
FieldSet & set(Tag tag, Int32 value)
Assigns the given value to the field.
FieldSet & setV(Tag tag, UInt64 value)
Assigns the given value to the field.
AccessPolicies policies_
Definition FieldSet.h:763
FieldSet & set(Tag tag, Int64 value)
Assigns the given value to the field.
FieldSet & setV(Tag tag, Double value, size_t precision=17)
Assigns the given value to the field.
FieldSet & setV(Tag tag, const Timestamp &value, TimestampFormat::Enum valueFormat=TimestampFormat::YYYYMMDDHHMMSSNsec)
Assigns the given value to the field.
FieldSet & set(Tag tag, const char *value)
Assigns the given value to the field.
bool erase(Tag tag)
Erases an association of the field with its value.
FieldSet & set(Tag tag, const std::string &value)
Assigns the given value to the field.
Group setGroup(Tag tag, size_t value)
Creates a new repeating group or changes the number of instances in the existing repeating group.
FieldSet & set(Tag tag, const TimeSpan &value, TimeSpanFormat::Enum valueFormat=TimeSpanFormat::HHMMSSNsec)
Assigns the given value to the field.
FieldSet & set(Tag tag, const StringRef &value)
Assigns the given value to the field.
Decimal getDecimal(Tag tag, Int32 exponent) const
Returns the field value as a decimal number with fixed exponent.
friend class MessageOperator
Definition FieldSet.h:785
Decimal getDecimal(Tag tag) const
Returns the field value as a decimal number.
FieldSet & set(Tag tag, Double value, size_t precision=17)
Assigns the given value to the field.
FieldSet & setV(Tag tag, const TimeSpan &value, TimeSpanFormat::Enum valueFormat=TimeSpanFormat::HHMMSSNsec)
Assigns the given value to the field.
UInt64 getUInt64(Tag tag) const
Returns a field value as an OnixS::FIX::UInt64 value.
FieldSet & setFlag(Tag tag, bool value)
Assigns the flag value ("Y" or "N") to the field.
size_t fields(Fields &fields) const
Retrieve tags and values of all non-empty fields belonged to the given FieldSet instance.
StringRef getStringRef(Tag tag) const
Returns reference to a read-only text chain.
bool contain(Tag tag) const
Returns 'true' if the field-set contains the field with the given tag, otherwise - 'false'.
Definition FieldSet.h:790
FieldSet & set(Tag tag, char value)
Assigns the given value to the field.
Int64 getInt64(Tag tag) const
Returns a field value as an OnixS::FIX::Int64 value.
FieldSet & setV(Tag tag, const Decimal &value)
Assigns the given value to the field.
FieldValueRef get(Tag tag) const
Returns a reference to the given field value.
ConstIterator begin() const
Returns the constant iterator to the first field in the FieldSet instance.
FieldSet & setV(Tag tag, Int32 value)
Assigns the given value to the field.
friend class GroupInstance
Definition FieldSet.h:784
TimeSpan getTimeSpan(Tag tag) const
Returns the field value as a time span.
~FieldSet() ONIXS_FIXENGINE_DEFAULT
FieldSet & set(Tag tag, const Decimal &value, size_t length)
Assigns the given value to the field.
Char getChar(Tag tag) const
Returns a field value as an OnixS::FIX::Char value.
FieldSet & set(Tag tag, const Decimal &value)
Assigns the given value to the field.
Implements a concept of a read-only reference to a FIX field value.
Encapsulates operations over the FIX Repeating Group.
Definition Group.h:108
Encapsulates operations over a FIX Message.
Definition Message.h:52
Provides an efficient way of accessing text-based FIX field values.
Definition StringRef.h:62
The time span related functionality.
Definition TimeSpan.h:94
The timestamps related functionality.
Definition Timestamp.h:92
double Double
Definition Numeric.h:41
unsigned int UInt32
Definition Numeric.h:36
long long Int64
Definition Numeric.h:38
char Char
Definition Numeric.h:30
unsigned long long UInt64
Definition Numeric.h:39
std::vector< Field > Fields
The ordered collection of fields.
Definition FieldSet.h:58
int Int32
Definition Numeric.h:35
unsigned Tag
Alias for tag numbers.
Definition Tag.h:28
Field primary attributes (the tag and a reference to a value).
Definition FieldSet.h:35
Field(Tag fieldTag, const FieldValueRef &fieldValue)
Initializes all members.
Definition FieldSet.h:48
Field()
Initializes the field which refers to nothing.
Definition FieldSet.h:43
FieldValueRef value
The field value reference.
Definition FieldSet.h:40
Tag tag
The field tag.
Definition FieldSet.h:37
@ HHMMSSNsec
Indicates the time span in the "HH:MM:SS.sssssssss" format.
Definition TimeSpan.h:85
@ YYYYMMDDHHMMSSNsec
Indicates the timestamp in the "YYYYMMDD-HH:MM:SS.sssssssss" format.
Definition Timestamp.h:83