blob: 55dcafc4c589203e147184568adb19ea03865516 (
plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
|
/*
* DNN - Data News Network
*
* by Stephane Chatty and Stephane Sire
*
* Copyright 1993-1996
* Centre d'Etudes de la Navigation Aerienne (CENA)
*
* Multiplexer.
*
* $Id$
* $CurLog$
*/
#ifndef IvlMultiplexer_H_
#define IvlMultiplexer_H_
#include "ivl/Initializer.h"
#include "ivl/List.h"
enum MPX_RES { isMpxEmpty, isMpxTerminated, isMpxError, isMpxAborted };
typedef void (IvlMpxHook) ();
class IvlBaseMultiplexer {
friend void IvlDnnOpen (IvlBaseMultiplexer*);
friend MPX_RES IvlLoop ();
friend void IvlClose ();
public:
static bool ClassInitialized;
static void ClassInit ();
static IvlInitializerFor <IvlBaseMultiplexer> Initializer;
protected:
static IvlList* GlobalHooks;
static IvlList* GlobalFinalHooks;
virtual MPX_RES Loop () = 0;
public:
IvlBaseMultiplexer ();
virtual ~IvlBaseMultiplexer ();
MPX_RES Run ();
virtual void Stop () = 0;
static void AddGlobalHook (IvlMpxHook*, bool = false);
static void RemoveGlobalHook (IvlMpxHook*, bool = false);
virtual void AddHook (IvlMpxHook*, bool = false) = 0;
virtual void RemoveHook (IvlMpxHook*, bool = false) = 0;
virtual void AddFinalHook (IvlMpxHook*) = 0;
virtual void RemoveFinalHook (IvlMpxHook*) = 0;
};
class IvlMultiplexer : public IvlBaseMultiplexer {
protected:
IvlList Hooks;
IvlList FinalHooks;
bool Looping;
void ExecHooks (bool = false);
MPX_RES Loop ();
public:
IvlMultiplexer ();
~IvlMultiplexer ();
void Stop ();
void AddHook (IvlMpxHook*, bool = false);
void RemoveHook (IvlMpxHook*, bool = false);
void AddFinalHook (IvlMpxHook*);
void RemoveFinalHook (IvlMpxHook*);
};
extern IvlBaseMultiplexer* IvlMpx;
extern void IvlDnnOpen (IvlBaseMultiplexer* = 0);
extern MPX_RES IvlLoop ();
extern void IvlStop ();
extern void IvlClose ();
#endif /* IvlMultiplexer_H_ */
|