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 <netinet/in.h>
19#include <arpa/inet.h>
20
21#include <string>
22#include <vector>
23
24namespace OksSystem {
25
32
33 class Host {
34protected:
35 std::string m_name ;
36 mutable std::string m_full_name ;
37 Host() throw() ;
38public:
39 static struct sockaddr_in resolve(const std::string &name) throw() ;
40 static std::string resolve(struct sockaddr_in address) throw() ;
41 static std::string expand(const std::string &name) throw() ;
42 static std::string to_string(struct sockaddr_in ip_addr) ;
43 Host(const Host &other) ;
44 Host(const std::string &name);
45 Host(struct sockaddr_in ip_addr);
46 virtual ~Host() throw();
47 operator struct sockaddr_in() const throw();
48 bool equals(const Host &other) const throw() ;
49 struct sockaddr_in ip() const throw() ;
50 const std::string & name() const throw() ;
51 const std::string & full_name() const throw() ;
52 std::string ip_string() const throw() ;
53 } ; // Host
54
55
56 bool operator ==(const Host &a, const Host &b) throw();
57 bool operator !=(const Host &a, const Host &b) throw();
58
59
66
67 class LocalHost : public Host {
68
69protected:
71 std::string m_os_name ;
72 std::string m_release ;
73 std::string m_version ;
74 std::string m_machine ;
75 mutable std::string m_description ;
76public:
77 static const std::string & local_name() throw() ;
78 static const std::string & full_local_name() throw() ;
79 static const LocalHost* instance() throw() ;
80 LocalHost() throw() ;
81 ~LocalHost() throw();
82 const std::string & os_name() const throw() ;
83 const std::string & os_release() const throw() ;
84 const std::string & os_version() const throw() ;
85 const std::string & machine() const throw() ;
86 const std::string & description() const throw() ;
87
88 } ; // LocalHost
89
90 const char* getfullhost() throw() ;
91
92 bool operator ==(const LocalHost &a, const LocalHost &b) throw();
93 bool operator !=(const LocalHost &a, const LocalHost &b) throw();
94
95
96} // OksSystem
97
98
99std::ostream& operator<<(std::ostream& stream, const OksSystem::Host& host) ;
100
101#endif
std::string ip_string() const
get ip in string mode
Definition Host.cpp:177
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:154
static std::string expand(const std::string &name)
expands to full name
Definition Host.cpp:74
struct sockaddr_in ip() const
get ip address
Definition Host.cpp:160
static std::string to_string(struct sockaddr_in ip_addr)
ip to string conversion
Definition Host.cpp:86
bool equals(const Host &other) const
equality method
Definition Host.cpp:142
const std::string & full_name() const
get fully qualified name
Definition Host.cpp:166
std::string m_name
name of the host
Definition Host.hpp:35
Host()
constructor for current host
Definition Host.cpp:97
std::string m_full_name
cached fully qualified host name
Definition Host.hpp:36
std::string m_os_name
name of the operating system
Definition Host.hpp:71
std::string m_version
version of the operating system
Definition Host.hpp:73
const std::string & description() const
machine type *‍/
Definition Host.cpp:291
static LocalHost * s_instance
singleton for local host
Definition Host.hpp:70
const std::string & os_release() const
release of the operating system
Definition Host.cpp:270
static const std::string & full_local_name()
fully qualified local host name
Definition Host.cpp:216
std::string m_machine
machine type
Definition Host.hpp:74
const std::string & os_name() const
name of the operating system
Definition Host.cpp:264
static const LocalHost * instance()
pointer to the singleton local host
Definition Host.cpp:226
const std::string & os_version() const
version of the operating system
Definition Host.cpp:276
static const std::string & local_name()
localhostname
Definition Host.cpp:207
std::string m_release
release of the operating system
Definition Host.hpp:72
const std::string & machine() const
version of the operating system
Definition Host.cpp:282
std::string m_description
machine description (cached)
Definition Host.hpp:75
const char * getfullhost()
get fully qualified host name
Definition Host.cpp:307