/* * CXorayaLogPlugin.h * * Created on: 25.10.2011 * Author: Eisenhauer */ #ifndef CXORAYALOGPLUGIN_H_ #define CXORAYALOGPLUGIN_H_ #include #include #include "bounded_buffer.hpp" #include "global.h" #include "plugin_api.h" #define nLOG_MSG_BUFFER_SIZE 8192 #define nINT_BUFF_SIZE 4096 #define nLOGFILENAME_LENGTH 256 class IInterfaceManager; class IPluginExecutor; class CXorayaLogPlugin: public IPlugin { public: CXorayaLogPlugin(); virtual ~CXorayaLogPlugin(); virtual void vRun(); virtual tpstCanTxMessage pxGetCanTxMessage( const uint32_t u32MsgIndex ) { return NULL; } virtual uint32_t u32GetNumOfCanTxMessages( void ) { return 0; } virtual bool boIsLogger( void ) { return true; } virtual bool boAutoload( void ) { return true; } virtual int32_t i32GetCanInterfaceHandle( void ); virtual tenRetCodes enGetLog(const char*, char*); virtual void vInit(void* pvExecutor, void* pvIfMan, int32_t i32Interface,uint32_t u32PluginId); void vStopIOThread(); void vStop(); virtual void vLogMessage(const tstLogMessage& stLogMessage); private: IInterfaceManager* m_pxIfMan; IPluginExecutor* m_pxExec; uint32_t m_u32PluginId; bool m_boStopIOThread; x2e::Mutex m_xStopIOFlagMutex; x2e::Mutex m_xLogBufferMutex; int m_iFd; char m_acLogBuffer[nINT_BUFF_SIZE]; char m_acLogfileName[nLOGFILENAME_LENGTH]; uint32_t m_u32LogMsgBufferCounter; bounded_buffer m_xLogMsgBuffer; boost::function m_fctThreadProc; boost::thread m_xIoThread; void vIoThreadProc(); void vInitLogfile(); tenRetCodes enRotateLogfile(); }; #endif /* CXORAYALOGPLUGIN_H_ */