ChimeraTK-DeviceAccess-DoocsBackend  01.09.02
DoocsBackendTimeStampAccessor.h
Go to the documentation of this file.
1 #pragma once
2 
4 #include <doocs/EqCall.h>
5 #include <type_traits>
6 
7 #include <ChimeraTK/SupportedUserTypes.h>
8 
9 namespace ChimeraTK {
10 
11  template<typename UserType>
13  public:
15 
16  protected:
17  DoocsBackendTimeStampRegisterAccessor(boost::shared_ptr<DoocsBackend> backend, const std::string& path,
18  const std::string& registerPathName, AccessModeFlags flags);
19 
20  void doPostRead(TransferType type, bool hasNewData) override;
21 
22  bool isReadOnly() const override { return true; }
23 
24  bool isReadable() const override { return true; }
25 
26  bool isWriteable() const override { return false; }
27 
28  bool doWriteTransfer(VersionNumber /*versionNumber = {}*/) override {
29  // do not throw again, already done in doPreWrite...
30  return false;
31  }
32 
33  friend class DoocsBackend;
34  };
35 
36  /**********************************************************************************************************************/
37 
38  template<typename UserType>
40  boost::shared_ptr<DoocsBackend> backend, const std::string& path, const std::string& registerPathName,
41  AccessModeFlags flags)
42  : DoocsBackendRegisterAccessor<UserType>(backend, path, registerPathName, 1, 0, flags) {}
43 
44  /**********************************************************************************************************************/
45 
46  template<typename UserType>
48  this->shutdown();
49  }
50 
51  /**********************************************************************************************************************/
52 
53  template<typename UserType>
54  void DoocsBackendTimeStampRegisterAccessor<UserType>::doPostRead(TransferType type, bool hasNewData) {
56  if(!hasNewData) return;
57 
59  auto timeStamp = d.get_timestamp();
60 
61  UserType val = numericToUserType<UserType>(timeStamp.get_seconds_since_epoch());
62  NDRegisterAccessor<UserType>::buffer_2D[0][0] = val;
63  }
64 
65 } // namespace ChimeraTK
ChimeraTK::DoocsBackendRegisterAccessor
Definition: DoocsBackendRegisterAccessor.h:75
ChimeraTK::DoocsBackendTimeStampRegisterAccessor::doPostRead
void doPostRead(TransferType type, bool hasNewData) override
Definition: DoocsBackendTimeStampAccessor.h:54
ChimeraTK::DoocsBackendTimeStampRegisterAccessor::DoocsBackendTimeStampRegisterAccessor
DoocsBackendTimeStampRegisterAccessor(boost::shared_ptr< DoocsBackend > backend, const std::string &path, const std::string &registerPathName, AccessModeFlags flags)
Definition: DoocsBackendTimeStampAccessor.h:39
ChimeraTK::DoocsBackendTimeStampRegisterAccessor::isWriteable
bool isWriteable() const override
Definition: DoocsBackendTimeStampAccessor.h:26
ChimeraTK::DoocsBackendTimeStampRegisterAccessor::isReadOnly
bool isReadOnly() const override
Definition: DoocsBackendTimeStampAccessor.h:22
ChimeraTK::DoocsBackendTimeStampRegisterAccessor
Definition: DoocsBackendTimeStampAccessor.h:12
ChimeraTK::DoocsBackendRegisterAccessor::doPostRead
void doPostRead(TransferType, bool hasNewData) override
Definition: DoocsBackendRegisterAccessor.h:108
ChimeraTK::DoocsBackendTimeStampRegisterAccessor::isReadable
bool isReadable() const override
Definition: DoocsBackendTimeStampAccessor.h:24
ChimeraTK::DoocsBackendTimeStampRegisterAccessor::~DoocsBackendTimeStampRegisterAccessor
~DoocsBackendTimeStampRegisterAccessor() override
Definition: DoocsBackendTimeStampAccessor.h:47
ChimeraTK
Definition: spec_DoocsBackend.dox:2
ChimeraTK::DoocsBackendTimeStampRegisterAccessor::doWriteTransfer
bool doWriteTransfer(VersionNumber) override
Definition: DoocsBackendTimeStampAccessor.h:28
ChimeraTK::DoocsBackend
Backend to access DOOCS control system servers.
Definition: DoocsBackend.h:56
DoocsBackendRegisterAccessor.h