GNU Octave  4.0.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-errno.h
Go to the documentation of this file.
1 // oct-errno.h.in
2 /*
3 
4 Copyright (C) 2005-2015 John W. Eaton
5 
6 This file is part of Octave.
7 
8 Octave is free software; you can redistribute it and/or modify it
9 under the terms of the GNU General Public License as published by the
10 Free Software Foundation; either version 3 of the License, or (at your
11 option) any later version.
12 
13 Octave is distributed in the hope that it will be useful, but WITHOUT
14 ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
15 FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License
16 for more details.
17 
18 You should have received a copy of the GNU General Public License
19 along with Octave; see the file COPYING. If not, see
20 <http://www.gnu.org/licenses/>.
21 
22 */
23 
24 #if !defined (octave_oct_errno_h)
25 #define octave_oct_errno_h 1
26 
27 #include <cerrno>
28 #include <map>
29 #include <string>
30 
31 #include "oct-map.h"
32 
33 class
35 {
36 protected:
37 
38  octave_errno (void);
39 
40 public:
41 
42  ~octave_errno (void) { }
43 
44  static bool instance_ok (void);
45 
46  static void cleanup_instance (void) { delete instance; instance = 0; }
47 
48  static int lookup (const std::string& name);
49 
50  static octave_scalar_map list (void);
51 
52  static int get (void) { return errno; }
53 
54  static int set (int val)
55  {
56  int retval = errno;
57  errno = val;
58  return retval;
59  }
60 
61 private:
62 
63  std::map<std::string, int> errno_tbl;
64 
66 
67  int do_lookup (const std::string& name);
68 
69  octave_scalar_map do_list (void);
70 };
71 
72 #endif
static void cleanup_instance(void)
Definition: oct-errno.h:46
static octave_errno * instance
Definition: oct-errno.h:65
octave_idx_type lookup(const T *x, octave_idx_type n, T y)
~octave_errno(void)
Definition: oct-errno.h:42
std::map< std::string, int > errno_tbl
Definition: oct-errno.h:63
static int set(int val)
Definition: oct-errno.h:54