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