GNU Octave  3.8.0
A high-level interpreted language, primarily intended for numerical computations, mostly compatible with Matlab
 All Classes Namespaces Files Functions Variables Typedefs Enumerations Enumerator Properties Friends Macros Pages
oct-uname.h
Go to the documentation of this file.
1 /*
2 
3 Copyright (C) 2005-2013 John W. Eaton
4 
5 This file is part of Octave.
6 
7 Octave is free software; you can redistribute it and/or modify it
8 under the terms of the GNU General Public License as published by the
9 Free Software Foundation; either version 3 of the License, or (at your
10 option) any later version.
11 
12 Octave is distributed in the hope that it will be useful, but WITHOUT
13 ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
14 FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License
15 for more details.
16 
17 You should have received a copy of the GNU General Public License
18 along with Octave; see the file COPYING. If not, see
19 <http://www.gnu.org/licenses/>.
20 
21 */
22 
23 #if !defined (octave_oct_uname_h)
24 #define octave_uname_h 1
25 
26 #include <string>
27 
28 class
29 OCTAVE_API
31 {
32 public:
33 
34  octave_uname (void)
35  : utsname_sysname ("unknown"), utsname_nodename ("unknown"),
36  utsname_release ("unknown"), utsname_version ("unknown"),
37  utsname_machine ("unknown"),
38  msg ("uname not supported on this system"), err (-1)
39  { init (); }
40 
42  : utsname_sysname (unm.utsname_sysname),
43  utsname_nodename (unm.utsname_nodename),
44  utsname_release (unm.utsname_release),
45  utsname_version (unm.utsname_version),
46  utsname_machine (unm.utsname_machine),
47  msg (unm.msg), err (unm.err)
48  { }
49 
50  octave_uname& operator = (const octave_uname& unm)
51  {
52  if (this != &unm)
53  {
54  utsname_sysname = unm.utsname_sysname;
55  utsname_nodename = unm.utsname_nodename;
56  utsname_release = unm.utsname_release;
57  utsname_version = unm.utsname_version;
58  utsname_machine = unm.utsname_machine;
59 
60  msg = unm.msg;
61  err = unm.err;
62  }
63 
64  return *this;
65  }
66 
67  ~octave_uname (void) { }
68 
69  std::string sysname (void) const { return utsname_sysname; }
70  std::string nodename (void) const { return utsname_nodename; }
71  std::string release (void) const { return utsname_release; }
72  std::string version (void) const { return utsname_version; }
73  std::string machine (void) const { return utsname_machine; }
74 
75  std::string message (void) const { return msg; }
76  int error (void) const { return err; }
77 
78 private:
79 
80  std::string utsname_sysname;
81  std::string utsname_nodename;
82  std::string utsname_release;
83  std::string utsname_version;
84  std::string utsname_machine;
85 
86  std::string msg;
87  int err;
88 
89  void init (void);
90 };
91 
92 #endif