OnixS C++ FIX Engine 4.14.0
Users' manual and 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 const Field * pointer;
720 typedef const Field & reference;
721
724
725 reference operator *() const {
726 return currentField_;
727 }
728
729 pointer 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
747
750
753
754protected:
755 // Policies to control the field access.
756 typedef size_t AccessPolicies;
757
758 // The underlying implementation.
759 void * impl_;
760
761 // The message to which the given set belongs to.
763
764 // Policies to control the field access.
766
767 // The uninitialized set.
769
770 // The uninitialized set.
771 FieldSet(const Message *, void *, AccessPolicies);
772
773 // The clone construction.
775
776 // The destruction available via descendants.
777 ~FieldSet() = default;
778
779 FieldSet & operator = (const FieldSet &);
780
781 // Swaps two instances.
782 void swap(FieldSet &);
783
784private:
785 friend class Message;
786 friend class GroupInstance;
787 friend class MessageOperator;
788};
789
790inline
791bool
793{
794 return get(tag).valid();
795}
796
797}
798}
#define ONIXS_FIXENGINE_API
Definition ABI.h:45
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)
UInt32 getUInt32(Tag tag) const
FieldSet & setV(Tag tag, Int64 value)
FieldSet & set(Tag tag, Double value, size_t precision, size_t length)
FieldSet & set(Tag tag, const Timestamp &value, TimestampFormat::Enum valueFormat=TimestampFormat::YYYYMMDDHHMMSSNsec)
Timestamp getTimestamp(Tag tag) const
Timestamp getTimestamp(Tag tag, TimestampFormat::Enum) const
FieldSet(const Message *, void *, AccessPolicies)
const Message * container_
Definition FieldSet.h:762
bool valid() const
FieldSet & set(Tag tag, const FieldValueRef &value)
Int32 getInt32(Tag tag) const
bool hasFlag(Tag tag) const
FieldSet & setV(Tag tag, UInt32 value)
void swap(FieldSet &)
FieldSet & set(Tag tag, UInt64 value)
FieldSet & setV(Tag tag, const Decimal &value, size_t length)
Double getDouble(Tag tag) const
FieldSet & set(Tag tag, UInt32 value)
ConstIterator const_iterator
Definition FieldSet.h:746
FieldSet(const FieldSet &)
Group getGroup(Tag numberOfInstancesTag) const
friend class Message
Definition FieldSet.h:785
ConstIterator end() const
Returns the constant iterator to the field after the last one in the FieldSet instance.
FieldSet & set(Tag tag, Int32 value)
FieldSet & setV(Tag tag, UInt64 value)
AccessPolicies policies_
Definition FieldSet.h:765
FieldSet & set(Tag tag, Int64 value)
FieldSet & setV(Tag tag, Double value, size_t precision=17)
FieldSet & setV(Tag tag, const Timestamp &value, TimestampFormat::Enum valueFormat=TimestampFormat::YYYYMMDDHHMMSSNsec)
FieldSet & set(Tag tag, const char *value)
bool erase(Tag tag)
FieldSet & set(Tag tag, const std::string &value)
Group setGroup(Tag tag, size_t value)
FieldSet & set(Tag tag, const TimeSpan &value, TimeSpanFormat::Enum valueFormat=TimeSpanFormat::HHMMSSNsec)
FieldSet & set(Tag tag, const StringRef &value)
Decimal getDecimal(Tag tag, Int32 exponent) const
friend class MessageOperator
Definition FieldSet.h:787
Decimal getDecimal(Tag tag) const
FieldSet & set(Tag tag, Double value, size_t precision=17)
FieldSet & setV(Tag tag, const TimeSpan &value, TimeSpanFormat::Enum valueFormat=TimeSpanFormat::HHMMSSNsec)
UInt64 getUInt64(Tag tag) const
FieldSet & setFlag(Tag tag, bool value)
size_t fields(Fields &fields) const
StringRef getStringRef(Tag tag) const
bool contain(Tag tag) const
Definition FieldSet.h:792
FieldSet & set(Tag tag, char value)
Int64 getInt64(Tag tag) const
FieldSet & setV(Tag tag, const Decimal &value)
FieldValueRef get(Tag tag) const
ConstIterator begin() const
Returns the constant iterator to the first field in the FieldSet instance.
FieldSet & setV(Tag tag, Int32 value)
friend class GroupInstance
Definition FieldSet.h:786
TimeSpan getTimeSpan(Tag tag) const
FieldSet & set(Tag tag, const Decimal &value, size_t length)
Char getChar(Tag tag) const
FieldSet & set(Tag tag, const Decimal &value)
The time span related functionality.
Definition TimeSpan.h:94
The timestamps related functionality.
Definition Timestamp.h:92
double Double
Definition Numeric.h:41
ONIXS_FIXENGINE_API_DECL(class, IEngineListener)
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