rllib  1
rleventlogserver.h
Go to the documentation of this file.
00001 /***************************************************************************
00002                           rleventlogserver.h  -  description
00003                              -------------------
00004     begin                : Wed Dec 18 2002
00005     copyright            : (C) 2002 by Rainer Lehrig
00006     email                : lehrig@t-online.de
00007  ***************************************************************************/
00008 
00009 /***************************************************************************
00010  *                                                                         *
00011  *   This library is free software; you can redistribute it and/or modify  *
00012  *   it under the terms of the GNU LESSER GENERAL PUBLIC LICENSE as        *
00013  *   published by the Free Software Foundation                             *
00014  *                                                                         *
00015  ***************************************************************************/
00016 #ifndef _RL_EVENT_LOG_SERVER_H_
00017 #define _RL_EVENT_LOG_SERVER_H_
00018 
00019 #include "rldefine.h"
00020 #include "rlevent.h"
00021 #include "rlthread.h"
00022 
00023 #define rlMAX_MESSAGES 128
00024 
00029 class rlEventLogServer
00030 {
00031   public:
00038     rlEventLogServer(const char *filename=NULL, int max_events=10000);
00039     virtual ~rlEventLogServer();
00040 
00045     const char *getEvent(char *buf, int *num);
00046     void        putEvent(const char *event);
00047 
00048   private:
00049     char    memory[rlMAX_MESSAGES*rlMAX_EVENT];
00050     rlMutex mutex;
00051     int     front;
00052     int     cnt;
00053     char    *filename;
00054     void    *fp;
00055     int     max_events, num_events;
00056 };
00057 
00062 class rlEventLogServerThreads
00063 {
00064   public:
00068     rlEventLogServerThreads(int port, rlEventLogServer *event_log_server);
00069     virtual ~rlEventLogServerThreads();
00070     void start();
00071     int getPort();
00072     rlEventLogServer *event_log_server;
00073 
00074   private:
00075     rlThread acceptThread;
00076     int port;
00077 };
00078 
00079 #endif