FairMQ  1.4.14
C++ Message Queuing Library and Framework
DDSAgent.h
1 /********************************************************************************
2  * Copyright (C) 2019 GSI Helmholtzzentrum fuer Schwerionenforschung GmbH *
3  * *
4  * This software is distributed under the terms of the *
5  * GNU Lesser General Public Licence (LGPL) version 3, *
6  * copied verbatim in the file "LICENSE" *
7  ********************************************************************************/
8 
9 #ifndef FAIR_MQ_SDK_DDSSAGENT_H
10 #define FAIR_MQ_SDK_DDSSAGENT_H
11 
12 #include <fairmq/sdk/DDSSession.h>
13 
14 #include <ostream>
15 #include <string>
16 #include <chrono>
17 #include <cstdint>
18 
19 namespace fair {
20 namespace mq {
21 namespace sdk {
22 
27 class DDSAgent
28 {
29  public:
30  using Id = uint64_t;
31  using Pid = uint32_t;
32 
33  explicit DDSAgent(DDSSession session,
34  Id id,
35  Pid pid,
36  std::string path,
37  std::string host,
38  std::chrono::milliseconds startupTime,
39  std::string username)
40  : fSession(std::move(session))
41  , fId(id)
42  , fPid(pid)
43  , fDDSPath(std::move(path))
44  , fHost(std::move(host))
45  , fStartupTime(startupTime)
46  , fUsername(std::move(username))
47  {}
48 
49  DDSSession GetSession() const { return fSession; }
50  Id GetId() const { return fId; }
51  Pid GetPid() const { return fPid; }
52  std::string GetHost() const { return fHost; }
53  std::string GetDDSPath() const { return fDDSPath; }
54  std::chrono::milliseconds GetStartupTime() const { return fStartupTime; }
55  std::string GetUsername() const { return fUsername; }
56 
57  friend auto operator<<(std::ostream& os, const DDSAgent& agent) -> std::ostream&
58  {
59  return os << "DDSAgent id: " << agent.fId
60  << ", pid: " << agent.fPid
61  << ", path: " << agent.fDDSPath
62  << ", host: " << agent.fHost
63  << ", startupTime: " << agent.fStartupTime.count()
64  << ", username: " << agent.fUsername;
65  }
66 
67  private:
68  DDSSession fSession;
69  Id fId;
70  Pid fPid;
71  std::string fDDSPath;
72  std::string fHost;
73  std::chrono::milliseconds fStartupTime;
74  std::string fUsername;
75 };
76 
77 } // namespace sdk
78 } // namespace mq
79 } // namespace fair
80 
81 #endif /* FAIR_MQ_SDK_DDSSAGENT_H */
Represents a DDS session.
Definition: DDSSession.h:56
Tools for interfacing containers to the transport via polymorphic allocators.
Definition: DeviceRunner.h:23
Represents a DDS agent.
Definition: DDSAgent.h:27

privacy