OnixS C++ FIX Engine 4.13.0
API Documentation
Loading...
Searching...
No Matches
FlatFieldRefAndKey.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 <cstdlib>
23
24namespace OnixS {
25namespace FIX {
26
28
33{
34public:
37 : valueOffset_(0),
38 valueSize_(0) {
39 }
40
43 : valueOffset_(valueOffset), valueSize_(valueSize) {
44 }
45
47 size_t valueOffset() const {
48 return valueOffset_;
49 }
50
52 size_t valueSize() const {
53 return valueSize_;
54 }
55
57 operator bool() const {
58 return (0 != valueOffset_);
59 }
60
62 bool
64 const FlatFieldRef & other) const {
65 return (
66 valueOffset_ == other.valueOffset_ &&
67 valueSize_ == other.valueSize_);
68 }
69
71 bool
73 const FlatFieldRef & other) const {
74 return (
75 valueOffset_ != other.valueOffset_ ||
76 valueSize_ != other.valueSize_);
77 }
78
79private:
80
81 size_t valueOffset_;
82 size_t valueSize_;
83};
84
86
92{
93public:
96 : key_(static_cast<size_t>(-1)) {
97 }
98
99 // Initializes valid key.
100 explicit FlatFieldKey(size_t key)
101 : key_(key) {
102 }
103
105 operator size_t() const {
106 return key_;
107 }
108
110 bool
112 const FlatFieldKey & other) const {
113 return (key_ == other.key_);
114 }
115
117 bool
119 const FlatFieldKey & other) const {
120 return (key_ != other.key_);
121 }
122
123private:
124
125 friend
126 struct
128
129 // Numeric value of the key.
130 size_t key_;
131};
132
134
142 static
145 return FlatFieldKey(0);
146 }
147
149 static
152 return FlatFieldKey(1);
153 }
154
156 static
159 return FlatFieldKey(2);
160 }
161
163 static
166 return FlatFieldKey(3);
167 }
168
170 static
173 return FlatFieldKey(4);
174 }
175};
176
178
179}
180}
Key to a serialized field - represents another way of accessing fields in an editable serialized mess...
bool operator==(const FlatFieldKey &other) const
Compares to the given instance.
bool operator!=(const FlatFieldKey &other) const
Compares to the given instance.
FlatFieldKey()
Initializes as a non-valid key.
Represents a temporary reference to a field in an editable serialized message.
FlatFieldRef()
Initializes as a references to nothing.
size_t valueOffset() const
Gets value offset.
size_t valueSize() const
Gets value size.
bool operator==(const FlatFieldRef &other) const
Compares the instance with the given one.
FlatFieldRef(size_t valueOffset, size_t valueSize)
Message only should use this constructor to initialize a valid reference.
bool operator!=(const FlatFieldRef &other) const
Compares the instance with the given one.
KnownFlatFieldKeys KnownSerializedFieldKeys
FlatFieldRef SerializedFieldRef
FlatFieldKey SerializedFieldKey
Keys are constant during the serialized message lifetime.
static FlatFieldKey dynamic()
Value of the first key to be allocated dynamically.
static FlatFieldKey sendingTime()
Key to access the SendingTime field.
static FlatFieldKey msgType()
Key to access the MsgType field.
static FlatFieldKey seqNumber()
Key to access the MsgSeqNum field.
static FlatFieldKey bodyLength()
Key to access the BodyLength field.