/* * 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 { private: void Load (int, DnnEventFeature*); public: DnnEventFeatureList (int, DnnEventFeature*); DnnEventFeatureList (const DnnEventFeatureList&, int, DnnEventFeature*); ~DnnEventFeatureList (); }; class DnnEventType { private: static void ClassInit (); protected: static CcuListOf * AllTypes; CcuString Name; #if 0 CcuListOf 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_ */