summaryrefslogtreecommitdiff
path: root/comm/OLD/ReqMgr.h
blob: 1b02196fe2ccbf61f5e0f19a2434b7a57e6ab7b5 (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
/*
 *	The Unix Channel
 *
 *	by Michel Beaudouin-Lafon
 *
 *	Copyright 1993
 *	Centre d'Etudes de la Navigation Aerienne (CENA)
 *
 *	Request management, by Stephane Chatty
 *
 *	$Id$
 *	$CurLog$
 */

#ifndef ReqMgr_H_
#define ReqMgr_H_

#include "ccu/String.h"
#include "ccu/List.h"
class ofstream;

class RequestField {
protected:
	CcuString	Name;
	CcuString	Type;
	CcuString	Impl;
public:
inline	RequestField (const char* n, const char* t, const char* i) : Name (n), Type (t), Impl (i)	{}
inline	const char*	GetName () const	{ return Name; }
inline	const char*	GetType () const	{ return Type; }
inline	const char*	GetImpl () const	{ return Impl; }
};

class RequestConstructor {
friend	int	yyparse ();
protected:
	CcuListOf <RequestField>	Params;
public:
inline	void	AddParameter (RequestField& f)	{ Params.Append (&f); }
inline	const CcuListOf <RequestField>& GetParameters () const	{ return Params; }
};

class RequestType {
friend	int	yyparse ();
protected:
	CcuString	Name;
	CcuListOf <RequestField> Fields;
	CcuListOf <RequestField> Getters;
	CcuListOf <RequestField> Setters;
	CcuListOf <RequestConstructor> Constructors;

public:
inline	RequestType (const char* n) : Name (n)	{ }
inline	void	AddField (RequestField* f)	{ Fields.Append (f); }
inline	void	AddConstructor (RequestConstructor* f)	{ Constructors.Append (f); }
inline	const char*	GetName () const	{ return Name; }
	void	Dump (ofstream&);
	void	DumpHeader (ofstream&);
	void	DumpSource (ofstream&);
};


class UchReqMgr {
friend	int	yyparse ();

protected:
	CcuString	Name;
	CcuListOf <RequestType> Requests;
	void	SetName (const char*);
inline	void	Add (RequestType* t)	{ Requests.Append (t); }

public:
		UchReqMgr ();
		~UchReqMgr ();
	void	Read (const char*);
	void	Dump (const char*);
	void	DumpHeader (const char*);
	void	DumpSource (const char*);
};

#endif	/* ReqMgr_H_ */