From d6bd0c0e8e08660606801e846273d4740947d658 Mon Sep 17 00:00:00 2001 From: chatty Date: Mon, 29 Nov 1993 11:08:19 +0000 Subject: Renamed into UchMsgMgr Heavy additions. --- comm/OLD/ReqMgr.h | 75 ++++++++++++++++++++++++++++++++++++------------------- 1 file changed, 50 insertions(+), 25 deletions(-) (limited to 'comm/OLD/ReqMgr.h') diff --git a/comm/OLD/ReqMgr.h b/comm/OLD/ReqMgr.h index 1b02196..811cca7 100644 --- a/comm/OLD/ReqMgr.h +++ b/comm/OLD/ReqMgr.h @@ -17,65 +17,90 @@ #include "ccu/String.h" #include "ccu/List.h" +#include "ccu/bool.h" + class ofstream; -class RequestField { +class MsgField { 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 MsgField (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 { +class MsgConstructor { friend int yyparse (); protected: - CcuListOf Params; + CcuListOf Params; public: -inline void AddParameter (RequestField& f) { Params.Append (&f); } -inline const CcuListOf & GetParameters () const { return Params; } +inline void AddParameter (MsgField& f) { Params.Append (&f); } +inline const CcuListOf & GetParameters () const { return Params; } }; -class RequestType { +class MsgType { friend int yyparse (); + +public: + enum msg_kind { isRequest, isAnswer, isEvent }; +static const char* const ClassSuffix [3]; +static const char* const EnumPrefix [3]; +static const char* const EnumSuffix [3]; + protected: CcuString Name; - CcuListOf Fields; - CcuListOf Getters; - CcuListOf Setters; - CcuListOf Constructors; + msg_kind Kind; + CcuListOf Fields; + CcuListOf Getters; + CcuListOf Setters; + CcuListOf Constructors; + bool DefaultConstructor; + 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 MsgType (const char* n, msg_kind k) : Name (n), Kind (k), DefaultConstructor (FALSE) {} +inline void AddField (MsgField* f) { Fields.Append (f); } +inline void AddConstructor (MsgConstructor* f) { Constructors.Append (f); } +inline void UseDefaultConstructor () { DefaultConstructor = TRUE; } inline const char* GetName () const { return Name; } - void Dump (ofstream&); - void DumpHeader (ofstream&); - void DumpSource (ofstream&); + void DumpDecl (ofstream&, int); + void DumpCode (ofstream&, int); }; +enum destination { isClient = 1<<0, isServer = 1<<1}; -class UchReqMgr { +class UchMsgMgr { friend int yyparse (); protected: CcuString Name; - CcuListOf Requests; + CcuListOf Requests; + CcuListOf Answers; + CcuListOf Events; void SetName (const char*); -inline void Add (RequestType* t) { Requests.Append (t); } +inline void AddRequest (MsgType* t) { Requests.Append (t); } +inline void AddAnswer (MsgType* t) { Answers.Append (t); } +inline void AddEvent (MsgType* t) { Events.Append (t); } + void DumpCode (const char*, int); + void DumpDecl (const char*, int); + void DumpEnum (ofstream&, MsgType::msg_kind, CcuListOf &); + void DumpClientCode (ofstream&); + void DumpServerCode (ofstream&); public: - UchReqMgr (); - ~UchReqMgr (); + UchMsgMgr (); + ~UchMsgMgr (); void Read (const char*); - void Dump (const char*); - void DumpHeader (const char*); - void DumpSource (const char*); + void DumpClientHeader (); + void DumpServerHeader (); + void DumpClientSource (const char*); + void DumpServerSource (const char*); +inline const char* GetName () const { return Name; } }; #endif /* ReqMgr_H_ */ + -- cgit v1.1