/* * 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 { private: void Load (int, IvlEventFeature*); public: IvlEventFeatureList (int, IvlEventFeature*); IvlEventFeatureList (const IvlEventFeatureList&, int, IvlEventFeature*); ~IvlEventFeatureList (); }; class IvlEventType { private: static void ClassInit (); protected: static IvlListOf * AllTypes; IvlString Name; #if 0 IvlListOf 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_ */