DUNE-DAQ
DUNE Trigger and Data Acquisition software
Loading...
Searching...
No Matches
Host.hpp
Go to the documentation of this file.
1// DUNE DAQ modification notice:
2// This file has been modified from the original ATLAS system source for the DUNE DAQ project.
3// Fork baseline commit: system-00-00-20 (2020-09-25).
4// Renamed since fork: yes (from system/Host.h to include/okssystem/Host.hpp).
5
6/*
7 * Host.h
8 * OksSystem
9 *
10 * Created by Matthias Wiesmann on 03.02.05.
11 * Copyright 2005 CERN. All rights reserved.
12 *
13 */
14
15#ifndef OKSSYSTEM_HOST
16#define OKSSYSTEM_HOST
17
18#include <arpa/inet.h>
19#include <netinet/in.h>
20
21#include <string>
22#include <vector>
23
24namespace OksSystem {
25
32
33class Host
34{
35protected:
36 std::string m_name;
37 mutable std::string m_full_name;
38 Host() throw();
39public:
40 static struct sockaddr_in resolve(const std::string& name) throw();
41 static std::string resolve(struct sockaddr_in address) throw();
42 static std::string expand(const std::string& name) throw();
43 static std::string to_string(struct sockaddr_in ip_addr);
44 Host(const Host& other);
45 Host(const std::string& name);
46 Host(struct sockaddr_in ip_addr);
47 virtual ~Host() throw();
48 operator struct sockaddr_in() const throw();
49 bool equals(const Host& other) const throw();
50 struct sockaddr_in ip() const throw();
51 const std::string& name() const throw();
52 const std::string& full_name() const throw();
53 std::string ip_string() const throw();
54}; // Host
55
56bool
57operator==(const Host& a, const Host& b) throw();
58bool
59operator!=(const Host& a, const Host& b) throw();
60
67
68class LocalHost : public Host
69{
70
71protected:
73 std::string m_os_name;
74 std::string m_release;
75 std::string m_version;
76 std::string m_machine;
77 mutable std::string m_description;
78public:
79 static const std::string& local_name() throw();
80 static const std::string& full_local_name() throw();
81 static const LocalHost* instance() throw();
82 LocalHost() throw();
83 ~LocalHost() throw();
84 const std::string& os_name() const throw();
85 const std::string& os_release() const throw();
86 const std::string& os_version() const throw();
87 const std::string& machine() const throw();
88 const std::string& description() const throw();
89
90}; // LocalHost
91
92const char*
93getfullhost() throw();
94
95bool
96operator==(const LocalHost& a, const LocalHost& b) throw();
97bool
98operator!=(const LocalHost& a, const LocalHost& b) throw();
99
100} // OksSystem
101
102std::ostream&
103operator<<(std::ostream& stream, const OksSystem::Host& host);
104
105#endif
std::string ip_string() const
get ip in string mode
Definition Host.cpp:198
static struct sockaddr_in resolve(const std::string &name)
name to ip conversion
Definition Host.cpp:37
const std::string & name() const
get name
Definition Host.cpp:165
static std::string expand(const std::string &name)
expands to full name
Definition Host.cpp:79
struct sockaddr_in ip() const
get ip address
Definition Host.cpp:175
static std::string to_string(struct sockaddr_in ip_addr)
ip to string conversion
Definition Host.cpp:94
bool equals(const Host &other) const
equality method
Definition Host.cpp:152
const std::string & full_name() const
get fully qualified name
Definition Host.cpp:185
std::string m_name
name of the host
Definition Host.hpp:36
Host()
constructor for current host
Definition Host.cpp:106
std::string m_full_name
cached fully qualified host name
Definition Host.hpp:37
std::string m_os_name
name of the operating system
Definition Host.hpp:73
std::string m_version
version of the operating system
Definition Host.hpp:75
const std::string & description() const
machine type *‍/
Definition Host.cpp:333
static LocalHost * s_instance
singleton for local host
Definition Host.hpp:72
const std::string & os_release() const
release of the operating system
Definition Host.cpp:306
static const std::string & full_local_name()
fully qualified local host name
Definition Host.cpp:243
std::string m_machine
machine type
Definition Host.hpp:76
const std::string & os_name() const
name of the operating system
Definition Host.cpp:298
static const LocalHost * instance()
pointer to the singleton local host
Definition Host.cpp:255
const std::string & os_version() const
version of the operating system
Definition Host.cpp:314
static const std::string & local_name()
localhostname
Definition Host.cpp:232
std::string m_release
release of the operating system
Definition Host.hpp:74
const std::string & machine() const
version of the operating system
Definition Host.cpp:322
std::string m_description
machine description (cached)
Definition Host.hpp:77
const char * getfullhost()
get fully qualified host name
Definition Host.cpp:351