Skip to content

Commit

Permalink
InstrumentProfileConnection::getLastModified
Browse files Browse the repository at this point in the history
  • Loading branch information
ttldtor committed Oct 14, 2023
1 parent 8b1f3fd commit 8b6a83d
Show file tree
Hide file tree
Showing 4 changed files with 31 additions and 0 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -146,6 +146,14 @@ class DXFCPP_EXPORT InstrumentProfileConnection final : public SharedEntity {
* @return The state of this instrument profile connections.
*/
State getState() const noexcept;

/**
* Returns last modification time (in milliseconds) of instrument profiles or zero if it is unknown.
* Note, that while the time is represented in milliseconds, the actual granularity of time here is a second.
*
* @return The last modification time (in milliseconds) of instrument profiles or zero if it is unknown.
*/
std::int64_t getLastModified() const noexcept;
};

} // namespace dxfcpp
1 change: 1 addition & 0 deletions include/dxfeed_graal_cpp_api/isolated/Isolated.hpp
Original file line number Diff line number Diff line change
Expand Up @@ -45,6 +45,7 @@ struct InstrumentProfileConnection {
static std::int64_t getUpdatePeriod(/* dxfg_ipf_connection_t * */ void* instrumentProfileConnectionHandle) noexcept;
static bool setUpdatePeriod(/* dxfg_ipf_connection_t * */ void* instrumentProfileConnectionHandle, std::int64_t updatePeriod) noexcept;
static dxfcpp::InstrumentProfileConnection::State getState(/* dxfg_ipf_connection_t * */ void* instrumentProfileConnectionHandle) noexcept;
static std::int64_t getLastModified(/* dxfg_ipf_connection_t * */ void* instrumentProfileConnectionHandle) noexcept;
};

struct InstrumentProfileList {
Expand Down
14 changes: 14 additions & 0 deletions src/internal/Isolate.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -410,6 +410,20 @@ InstrumentProfileConnection::getState(/* dxfg_ipf_connection_t * */ void *instru
dxfcpp::bit_cast<dxfg_ipf_connection_t *>(instrumentProfileConnectionHandle));
}

std::int64_t InstrumentProfileConnection::getLastModified(
/* dxfg_ipf_connection_t * */ void *instrumentProfileConnectionHandle) noexcept {
if (!instrumentProfileConnectionHandle) {
return 0;
}

return runIsolatedOrElse(
[](auto threadHandle, auto &&instrumentProfileConnectionHandle) {
return dxfg_InstrumentProfileConnection_getLastModified(
dxfcpp::bit_cast<graal_isolatethread_t *>(threadHandle), instrumentProfileConnectionHandle);
},
0, dxfcpp::bit_cast<dxfg_ipf_connection_t *>(instrumentProfileConnectionHandle));
}

bool InstrumentProfileList::release(/* dxfg_instrument_profile_list * */ void *graalInstrumentProfileList) noexcept {
if (!graalInstrumentProfileList) {
return false;
Expand Down
8 changes: 8 additions & 0 deletions src/ipf/live/InstrumentProfileConnection.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -73,4 +73,12 @@ InstrumentProfileConnection::State InstrumentProfileConnection::getState() const
return isolated::ipf::InstrumentProfileConnection::getState(handle_.get());
}

std::int64_t InstrumentProfileConnection::getLastModified() const noexcept {
if (!handle_) {
return 0;
}

return isolated::ipf::InstrumentProfileConnection::getLastModified(handle_.get());
}

} // namespace dxfcpp

0 comments on commit 8b6a83d

Please sign in to comment.