GNU Octave
3.8.0
A high-level interpreted language, primarily intended for numerical computations, mostly compatible with Matlab
Main Page
Namespaces
Classes
Files
File List
File Members
All
Classes
Namespaces
Files
Functions
Variables
Typedefs
Enumerations
Enumerator
Properties
Friends
Macros
Pages
liboctave
util
singleton-cleanup.h
Go to the documentation of this file.
1
#if !defined (octave_singleton_cleanup_h)
2
#define octave_singleton_cleanup_h 1
3
4
#include <set>
5
6
class
7
OCTAVE_API
8
singleton_cleanup_list
9
{
10
protected
:
11
12
singleton_cleanup_list
(
void
) : fcn_list () { }
13
14
public
:
15
16
typedef
void
(*
fptr
) (
void
);
17
18
~
singleton_cleanup_list
(
void
);
19
20
static
void
add (
fptr
f
)
21
{
22
if
(instance_ok ())
23
instance->do_add (f);
24
}
25
26
static
void
cleanup
(
void
) {
delete
instance; instance = 0; }
27
28
private
:
29
30
static
singleton_cleanup_list
*
instance
;
31
32
static
bool
instance_ok (
void
);
33
34
static
void
cleanup_instance
(
void
) {
delete
instance; instance = 0; }
35
36
std::set<fptr>
fcn_list
;
37
38
void
do_add (
fptr
f
)
39
{
40
fcn_list.insert (f);
41
}
42
43
// No copying!
44
45
singleton_cleanup_list
(
const
singleton_cleanup_list
&);
46
47
singleton_cleanup_list
& operator = (
const
singleton_cleanup_list
&);
48
};
49
50
#endif
Generated on Mon Dec 30 2013 03:04:55 for GNU Octave by
1.8.1.2