/* * EventBufferCore.h * * * Created on: 20 Aug 2017 * Author: wentzelc */ #ifndef REDACORE_EVENTBUFFERCORE_H_ #define REDACORE_EVENTBUFFERCORE_H_ //--------------------------------------------------------------------------- // Standard C/C++ Libraries /* none */ // redA Libraries #include "ItemBufferCore.h" //--------------------------------------------------------------------------- // Prototypes class CEventBuffer; typedef struct SEventEntry TEventEntry; typedef struct SEventType TEventType; //--------------------------------------------------------------------------- // Data Structures struct SEventEntry { unsigned EventNo; char * EventType; char * Parent; char * DeviceName; char * ParamName; char * Value; char DateTime[20]; char * SourceName; }; struct SEventType { char * Name; TEventType * Next; }; //--------------------------------------------------------------------------- // General Event life cycle functions TEventEntry * CreateEvent(); TEventEntry * CreateEvent( const char * EventType, const char * Parent, const char * DeviceName, const char * ParamName, long Value, const char * DateTimeStr, const char * SourceName ); TEventEntry * CreateEvent( const char * EventType, const char * Parent, const char * DeviceName, const char * ParamName, double Value, const char * DateTimeStr, const char * SourceName ); TEventEntry * CreateEvent( const char * EventType, const char * Parent, const char * DeviceName, const char * ParamName, const char * Value, const char * DateTimeStr, const char * SourceName ); TEventEntry * CopyEvent( TEventEntry * Event ); bool DestroyEvent( TEventEntry ** Event ); //--------------------------------------------------------------------------- // Event buffer abstract object (base class) class CEventBuffer : protected CItemBuffer { protected: char Name[31]; CEventBuffer * PeerBuffer; TEventType * FirstEventType; public: CEventBuffer( const char * BufferName ); virtual ~CEventBuffer(); // Markers TEventEntry * CurrentEvent; unsigned int EventCount; char * GetName() { return Name; }; // Initialisation bool SetPeerBuffer( CEventBuffer *pPeerBuffer ); // Filter List bool SetEventFilter( int n, ... ); bool PassEventFilter( TEventEntry * Event ); // Buffering virtual bool AddEvent( TEventEntry * Event, unsigned int EventNo = 0 ); virtual TEventEntry * GetNextEvent( bool &Error ); virtual bool ClearCurrentEvent(); virtual bool ClearLastEvent( bool FreeEvent ); virtual bool DestroyEntry( void ** Entry ); }; //--------------------------------------------------------------------------- #endif /*REDACORE_EVENTBUFFERCORE_H_*/