summaryrefslogtreecommitdiff
path: root/dnn/Source.h
blob: 84b72ed39653abadcab9ecac4752e7d86daf5cbb (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
/*
 *	DNN - Data News Network
 *
 *	by Stephane Chatty
 *
 *	Copyright 1993-1996
 *	Centre d'Etudes de la Navigation Aerienne (CENA)
 *
 *	Event sources.
 *
 *	$Id$
 *	$CurLog$
 */

#ifndef IvlSource_H_
#define IvlSource_H_

#include "cplus_bugs.h"
template <class ITEM> class IvlArrayOf;
template <class ITEM> class IvlHashTableOf;
class IvlTrigger;
class IvlEvent;
class IvlBaseReaction;

class IvlEventSource {
protected:
		IvlEventSource ();
virtual		~IvlEventSource ();
	void	Emit (IvlEvent*);
virtual	void	DispatchEvent (IvlEvent*) = 0;
};

class IvlEventSelector {
public:
		IvlEventSelector ();
virtual		~IvlEventSelector ();
virtual	IvlTrigger*	FindTrigger (IvlEvent*) = 0;
};

typedef int (*IvlIntExtractor) (IvlEvent*);

class IvlEventIntSelector : public IvlEventSelector {
protected:
	IvlIntExtractor	IdExtractor;
	int	MaxSize;
	IvlArrayOf<IvlTrigger>	*Triggers;
public:
		IvlEventIntSelector (IvlIntExtractor, int);
		~IvlEventIntSelector ();
	IvlTrigger*	UseTrigger (int);
	void	UnuseTrigger (int, IvlBaseReaction*);
	IvlTrigger*	FindTrigger (IvlEvent*);
};

typedef void* (*IvlPtrExtractor) (IvlEvent*);

class IvlEventPtrSelector : public IvlEventSelector {
protected:
	IvlPtrExtractor	PtrExtractor;
	int	TblSize;
	IvlHashTableOf<IvlTrigger>	*Triggers;
public:
		IvlEventPtrSelector (IvlPtrExtractor, int);
		~IvlEventPtrSelector ();
	IvlTrigger*	UseTrigger (void*);
	void	UnuseTrigger (void*, IvlBaseReaction*);
	IvlTrigger*	FindTrigger (IvlEvent*);
};

#endif	/* IvlSource_H_ */