FairMQ  1.4.33
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::mq::sdk
20 {
21 
26 class DDSAgent
27 {
28  public:
29  using Id = uint64_t;
30  using Pid = uint32_t;
31 
32  explicit DDSAgent(DDSSession session,
33  Id id,
34  Pid pid,
35  std::string path,
36  std::string host,
37  std::chrono::milliseconds startupTime,
38  std::string username)
39  : fSession(std::move(session))
40  , fId(id)
41  , fPid(pid)
42  , fDDSPath(std::move(path))
43  , fHost(std::move(host))
44  , fStartupTime(startupTime)
45  , fUsername(std::move(username))
46  {}
47 
48  DDSSession GetSession() const { return fSession; }
49  Id GetId() const { return fId; }
50  Pid GetPid() const { return fPid; }
51  std::string GetHost() const { return fHost; }
52  std::string GetDDSPath() const { return fDDSPath; }
53  std::chrono::milliseconds GetStartupTime() const { return fStartupTime; }
54  std::string GetUsername() const { return fUsername; }
55 
56  friend auto operator<<(std::ostream& os, const DDSAgent& agent) -> std::ostream&
57  {
58  return os << "DDSAgent id: " << agent.fId
59  << ", pid: " << agent.fPid
60  << ", path: " << agent.fDDSPath
61  << ", host: " << agent.fHost
62  << ", startupTime: " << agent.fStartupTime.count()
63  << ", username: " << agent.fUsername;
64  }
65 
66  private:
67  DDSSession fSession;
68  Id fId;
69  Pid fPid;
70  std::string fDDSPath;
71  std::string fHost;
72  std::chrono::milliseconds fStartupTime;
73  std::string fUsername;
74 };
75 
76 } // namespace fair::mq::sdk
77 
78 #endif /* FAIR_MQ_SDK_DDSSAGENT_H */
fair::mq::sdk::DDSSession
Represents a DDS session.
Definition: DDSSession.h:62
fair::mq::sdk::DDSAgent
Represents a DDS agent.
Definition: DDSAgent.h:33

privacy