/* * The Unix Channel * * by Michel Beaudouin-Lafon * * Copyright 1993 * Centre d'Etudes de la Navigation Aerienne (CENA) * * Events, by Stephane Chatty * * $Id$ * $CurLog$ */ #ifndef UchEvent_H_ #define UchEvent_H_ #include "cplus_bugs.h" #include "global.h" #include "ccu/String.h" #include "ccu/List.h" #include "Message.h" class UchIOS; #if 0 class UchEventFeature { protected: CcuString Name; UchEventFeatureType& Type; public: inline UchEventFeature (const char* n, UchEventFeatureType& t) : Name (n), Type (t) {} inline ~UchEventFeature () {} }; #endif struct UchEventFeature { const char* Name; int Size; }; class UchEventFeatureList : public CcuListOf { private: void Load (int, UchEventFeature*); public: UchEventFeatureList (int, UchEventFeature*); UchEventFeatureList (const UchEventFeatureList&, int, UchEventFeature*); ~UchEventFeatureList (); }; class UchEventType { private: static void ClassInit (); protected: static CcuListOf * AllTypes; CcuString Name; #if 0 CcuListOf Features; #endif int NbFeatures; int* FeaturesOffsets; public: UchEventType (const char*, int, UchEventFeature []); UchEventType (const char*, const UchEventFeatureList&); ~UchEventType (); inline int operator == (const UchEventType& evt) const { return (this == &evt); } inline int GetTotalSize () const { return FeaturesOffsets [NbFeatures - 1]; } 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, UchEventFeatureType& t) { Features->Append (new UchEventFeature (fn, t); } inline void RemoveFeature () { } #endif }; class UchEvent : public UchMessage { protected: const UchEventType& Type; char* Data; void ReadFrom (UchIOS&, lword); void WriteTo (UchIOS&); public: UchEvent (const UchEventType*); ~UchEvent (); void SetFeature (int, const void*); void GetFeature (int, void*); inline const UchEventType& GetType () const { return Type; } }; #endif /* UchEvent_H_ */