6#include "../../internal/Conf.hpp"
10#include "../../entity/SharedEntity.hpp"
11#include "../../internal/Common.hpp"
12#include "../../internal/Id.hpp"
13#include "../../internal/JavaObjectHandle.hpp"
14#include "./InstrumentProfileCollector.hpp"
15#include "../../internal/Handler.hpp"
18
19
20
25
26
27
28
32 using Ptr = std::shared_ptr<InstrumentProfileConnection>;
35 using Unique = std::unique_ptr<InstrumentProfileConnection>;
38
39
42
43
44
48
49
53
54
58
59
63
64
69 Id<InstrumentProfileConnection> id_;
70 JavaObjectHandle<InstrumentProfileConnection> handle_{};
71 JavaObjectHandle<IpfPropertyChangeListener> stateChangeListenerHandle_{};
72 SimpleHandler<
void(
State,
State)> onStateChange_{};
74 InstrumentProfileConnection()
noexcept;
80
81
82
83
84
87 static std::string stateToString(
State state)
noexcept;
90
91
92
93
94
95
96
97
98
99
100
101
102
106
107
108
109
110
114
115
116
117
118
119
120
121
125
126
127
128
129
130
131
132
136
137
138
139
140
144
145
146
147
148
152
153
154
155
159
160
161
162
163
167
168
169
170
174
175
176
180
181
182
183
184
185
186
187
188
189 template <
typename StateChangeListener>
197 return onStateChange_ += listener;
201
202
203
204
205
206
210
211
212
213
214
218
219
220
221
222
223
227
228
229
230
231
232
#define DXFCXX_DISABLE_MSC_WARNINGS_POP()
Definition Conf.hpp:31
#define DXFCPP_END_NAMESPACE
Definition Conf.hpp:97
#define DXFCPP_BEGIN_NAMESPACE
Definition Conf.hpp:94
#define DXFCXX_DISABLE_MSC_WARNINGS_PUSH(warnings)
Definition Conf.hpp:30
#define DXFCPP_EXPORT
Definition api.h:35
~InstrumentProfileConnection() noexcept override
Removes the native state listener and closes this connection.
Definition InstrumentProfileConnection.cpp:61
static Ptr createConnection(const StringLike &address, InstrumentProfileCollector::Ptr collector)
Creates instrument profile connection with a specified address and collector.
Definition InstrumentProfileConnection.cpp:100
bool waitUntilCompleted(std::chrono::milliseconds timeout) const
Synchronously waits for full first snapshot read with the specified timeout.
Definition InstrumentProfileConnection.cpp:167
State getState() const
Returns state of this instrument profile connections.
Definition InstrumentProfileConnection.cpp:138
void removeStateChangeListener(std::size_t listenerId)
Removes listener that is notified about changes in state property.
Definition InstrumentProfileConnection.cpp:154
void close() const
Closes this instrument profile connection.
Definition InstrumentProfileConnection.cpp:150
std::int64_t getLastModified() const
Returns last modification time (in milliseconds) of instrument profiles or zero if it is unknown.
Definition InstrumentProfileConnection.cpp:142
State
Instrument profile connection state.
Definition InstrumentProfileConnection.hpp:40
@ CLOSED
Instrument profile connection was closed.
Definition InstrumentProfileConnection.hpp:65
@ COMPLETED
Initial instrument profiles snapshot was fully read (this state is set only once).
Definition InstrumentProfileConnection.hpp:60
@ CONNECTING
Connection is being established.
Definition InstrumentProfileConnection.hpp:50
@ CONNECTED
Connection was established.
Definition InstrumentProfileConnection.hpp:55
@ NOT_CONNECTED
Instrument profile connection is not started yet.
Definition InstrumentProfileConnection.hpp:45
std::string getAddress() const
Returns the address of this instrument profile connection.
Definition InstrumentProfileConnection.cpp:118
std::int64_t getUpdatePeriod() const
Returns update period in milliseconds.
Definition InstrumentProfileConnection.cpp:122
void start() const
Starts this instrument profile connection.
Definition InstrumentProfileConnection.cpp:146
void setUpdatePeriod(std::int64_t updatePeriod) const
Changes the update period in milliseconds.
Definition InstrumentProfileConnection.cpp:130
std::size_t addStateChangeListener(StateChangeListener &&listener)
Adds listener that is notified about changes in state property.
Definition InstrumentProfileConnection.hpp:190
void setUpdatePeriod(std::chrono::milliseconds updatePeriod) const
Changes the update period in milliseconds as chrono::duration.
Definition InstrumentProfileConnection.cpp:134
std::chrono::milliseconds getUpdatePeriodAsDuration() const
Returns update period in milliseconds as chrono::duration It is period of an update check when the in...
Definition InstrumentProfileConnection.cpp:126
SimpleHandler< void(State, State)> & onStateChange()
Returns the onStateChange handler that can be used to add or remove listeners.
Definition InstrumentProfileConnection.cpp:159
bool waitUntilCompleted(std::int64_t timeout) const
Synchronously waits for full first snapshot read with the specified timeout.
Definition InstrumentProfileConnection.cpp:163
A base abstract "shared entity" class. Has some helpers for dynamic polymorphism.
Definition SharedEntity.hpp:25
A lightweight wrapper around strings or string-like inputs.
Definition StringUtils.hpp:28