GNU Octave
9.1.0
A high-level interpreted language, primarily intended for numerical computations, mostly compatible with Matlab
singleton-cleanup.h
Go to the documentation of this file.
1
////////////////////////////////////////////////////////////////////////
2
//
3
// Copyright (C) 2011-2024 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_singleton_cleanup_h)
27
#define octave_singleton_cleanup_h 1
28
29
#include "octave-config.h"
30
31
#include <set>
32
33
class
34
OCTAVE_API
35
singleton_cleanup_list
36
{
37
protected
:
38
39
singleton_cleanup_list
() : m_fcn_list () { }
40
41
public
:
42
43
typedef
void (*
fptr
) ();
44
45
OCTAVE_DISABLE_COPY_MOVE (
singleton_cleanup_list
)
46
47
~
singleton_cleanup_list
();
48
49
static
void
add
(
fptr
f
)
50
{
51
if
(instance_ok ())
52
s_instance->do_add (
f
);
53
}
54
55
static
void
cleanup
()
56
{
57
delete
s_instance;
58
s_instance =
nullptr
;
59
}
60
61
private
:
62
63
static
singleton_cleanup_list
*s_instance;
64
65
static
bool
instance_ok ();
66
67
static
void
cleanup_instance ()
68
{
69
delete
s_instance;
70
s_instance =
nullptr
;
71
}
72
73
std::set<fptr> m_fcn_list;
74
75
void
do_add (
fptr
f
)
76
{
77
m_fcn_list.insert (
f
);
78
}
79
};
80
81
#endif
singleton_cleanup_list
Definition:
singleton-cleanup.h:36
singleton_cleanup_list::add
static void add(fptr f)
Definition:
singleton-cleanup.h:49
singleton_cleanup_list::cleanup
static void cleanup()
Definition:
singleton-cleanup.h:55
singleton_cleanup_list::singleton_cleanup_list
singleton_cleanup_list()
Definition:
singleton-cleanup.h:39
f
F77_RET_T const F77_DBLE const F77_DBLE * f
Definition:
lo-slatec-proto.h:39
fptr
FloatComplex(* fptr)(const FloatComplex &, float, int, octave_idx_type &)
Definition:
lo-specfun.cc:1102
OCTAVE_API
#define OCTAVE_API
Definition:
main.cc:55
liboctave
util
singleton-cleanup.h
Generated on Sun Mar 17 2024 22:36:52 for GNU Octave by
1.9.1