summaryrefslogtreecommitdiff
path: root/dnn/Event.h
blob: 3b9ac6b3c71293c6c82c15f9ee4e6791c50f5ebf (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
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
/*
 *	DNN - Data News Network
 *
 *	by Stephane Chatty
 *
 *	Copyright 1993-1995
 *	Centre d'Etudes de la Navigation Aerienne (CENA)
 *
 *	Events.
 *
 *	$Id$
 *	$CurLog$
 */

#ifndef IvlEvent_H_
#define IvlEvent_H_

#include "cplus_bugs.h"
#include "ivl/String.h"
#include "ivl/List.h"
#include "ivl/bool.h"

#if 0

class IvlEventFeature {
protected:
	IvlString	Name;
	IvlEventFeatureType&	Type;

public:
inline		IvlEventFeature (const char* n, IvlEventFeatureType& t) : Name (n), Type (t)	{}
inline		~IvlEventFeature ()	{}
};

#else

struct IvlEventFeature {
	const char*	Name;
	int	Size;
};

#endif

class IvlEventFeatureList : public IvlListOf <IvlEventFeature> {
private:
	void	Load (int, IvlEventFeature*);

public:
		IvlEventFeatureList (int, IvlEventFeature*);
		IvlEventFeatureList (const IvlEventFeatureList&, int, IvlEventFeature*);
		~IvlEventFeatureList ();
};

class IvlEventType {
private:
static	void	ClassInit ();

protected:
static	IvlListOf <IvlEventType>*	AllTypes;
	IvlString	Name;
#if 0
	IvlListOf <IvlEventFeature>	Features;
#endif
	int	NbFeatures;
	int*	FeaturesOffsets;

public:
		IvlEventType (const char*, int, IvlEventFeature []);
		IvlEventType (const char*, const IvlEventFeatureList&);
		~IvlEventType ();
inline	int	operator == (const IvlEventType& evt) const	{ return (this == &evt); }
inline	const char*	GetName () const	{ return Name; }
inline	int	GetTotalSize () const	{ return (NbFeatures) > 0 ? FeaturesOffsets [NbFeatures - 1] : 0; }
inline	int	GetOffset (int i) const	{ return i ? FeaturesOffsets [i-1] : 0; }
inline	int	GetSize (int i) const	{ return FeaturesOffsets [i] - (i ? FeaturesOffsets [i-1] : 0); }
#if 0
inline	void	AddFeature (const char* fn, IvlEventFeatureType& t)	{ Features->Append (new IvlEventFeature (fn, t); }
inline	void	RemoveFeature ()	{ }
#endif
};

class IvlEvent {
public:
		IvlEvent ();
		IvlEvent (const IvlEventType*);	// useless, for compatibility only
virtual		~IvlEvent ();
};

class IvlBasicEvent : public IvlEvent {
protected:
	const IvlEventType&	Type;
	char*	Data;

		IvlBasicEvent (const IvlEventType*, bool);
public:
		IvlBasicEvent (const IvlEventType*);
		~IvlBasicEvent ();
	void	SetFeature (int, const void*);
	void	GetFeature (int, void*);
inline	const IvlEventType*	GetType () const	{ return &Type; }
};

#endif	/* IvlEvent_H_ */