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

#ifndef DnnEvent_H_
#define DnnEvent_H_

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

#if 0

class DnnEventFeature {
protected:
	CcuString	Name;
	DnnEventFeatureType&	Type;

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

#else

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

#endif

class DnnEventFeatureList : public CcuListOf <DnnEventFeature> {
private:
	void	Load (int, DnnEventFeature*);

public:
		DnnEventFeatureList (int, DnnEventFeature*);
		DnnEventFeatureList (const DnnEventFeatureList&, int, DnnEventFeature*);
		~DnnEventFeatureList ();
};

class DnnEventType {
private:
static	void	ClassInit ();

protected:
static	CcuListOf <DnnEventType>*	AllTypes;
	CcuString	Name;
#if 0
	CcuListOf <DnnEventFeature>	Features;
#endif
	int	NbFeatures;
	int*	FeaturesOffsets;

public:
		DnnEventType (const char*, int, DnnEventFeature []);
		DnnEventType (const char*, const DnnEventFeatureList&);
		~DnnEventType ();
inline	int	operator == (const DnnEventType& 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, DnnEventFeatureType& t)	{ Features->Append (new DnnEventFeature (fn, t); }
inline	void	RemoveFeature ()	{ }
#endif
};

class DnnEvent {
protected:
	const DnnEventType&	Type;
	char*	Data;

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

#endif	/* DnnEvent_H_ */