00001 #ifndef __eventLog_h__
00002 #define __eventLog_h__
00003
00004 #include <posix_evlog.h>
00005
00006 #include "eventQuery.h"
00007 #include <string>
00008 #include "rmBaseArray.h"
00009 #include "rmClientTypes.h"
00010
00011 enum SearchOption
00012 {
00013 FIND_ID = 1,
00014 FIND_NEXT_ID
00015 };
00016
00022 struct EventLog
00023 {
00024 posix_log_entry entry;
00025 string data;
00026 };
00027
00038 class eventLog : public IBaseAccessor
00039 {
00040 public:
00041 eventLog(eventQuery * aEventQuery);
00042 virtual ~eventLog();
00043
00044 size_t getCount() const
00045 {
00046 return RMCLIENT_ERROR_NOT_IMPLEMENTED;
00047 }
00048
00049 EventLog * getElement(unsigned long aID){
00050 return NULL;
00051 }
00052
00053 int addElement(const EventLog & aElement, unsigned long aID)
00054 {
00055 return RMCLIENT_ERROR_NOT_IMPLEMENTED;
00056 }
00057
00058 int newElement(const EventLog & aElement, unsigned long & aID)
00059 {
00060 return RMCLIENT_ERROR_NOT_IMPLEMENTED;
00061 }
00062
00063 int addDefaultElement(unsigned long aID)
00064 {
00065 return RMCLIENT_ERROR_NOT_IMPLEMENTED;
00066 }
00067
00068 int removeElement(unsigned long aID)
00069 {
00070 return RMCLIENT_ERROR_NOT_IMPLEMENTED;
00071 }
00072
00073 int modifyElement(unsigned long aID, const EventLog & aElement)
00074 {
00075 return RMCLIENT_ERROR_NOT_IMPLEMENTED;
00076 }
00077
00078 unsigned long getNewId(void)
00079 {
00080 return RMCLIENT_ERROR_NOT_IMPLEMENTED;
00081 }
00082
00083 int setInteger32(RMAttribute aName, unsigned long aID, long aValue)
00084 {
00085 return RMCLIENT_ERROR_NOT_IMPLEMENTED;
00086 }
00087
00088 int setUnsigned64(RMAttribute aName, unsigned long aID, u_int64_t aValue)
00089 {
00090 return RMCLIENT_ERROR_NOT_IMPLEMENTED;
00091 }
00092
00093 int setUUIDString(RMAttribute aName, unsigned long aID, char * aUUIDStr)
00094 {
00095 return RMCLIENT_ERROR_NOT_IMPLEMENTED;
00096 }
00097
00098 bool elementIsReady(const EventLog & aElement) const
00099 {
00100 return RMCLIENT_ERROR_NOT_IMPLEMENTED;
00101 }
00102
00103 int getUnsigned64(RMAttribute aName, unsigned long aID, u_int64_t & aValue)
00104 {
00105 return RMCLIENT_ERROR_NOT_IMPLEMENTED;
00106 }
00107
00108 int getUUIDString(RMAttribute aName, unsigned long aID, char * aUUIDStr)
00109 {
00110 return RMCLIENT_ERROR_NOT_IMPLEMENTED;
00111 }
00112
00113 int getUUID(RMAttribute aName, unsigned long aID, uuid_t aUUID)
00114 {
00115 return RMCLIENT_ERROR_NOT_IMPLEMENTED;
00116 }
00117
00118 unsigned long getMaxId(void)
00119 {
00120 return RMCLIENT_ERROR_NOT_IMPLEMENTED;
00121 }
00122
00123 int findExactId(unsigned long aID)
00124 {
00125 return findId(aID);
00126 }
00127
00129 int init();
00130
00132 const EventLog * getConstElement(unsigned long aID);
00133
00135 int findId(unsigned long aID);
00136
00138 int getNextId(unsigned long aID, unsigned long & aNextID);
00139
00141 int getInteger32(RMAttribute aName, unsigned long aID, long & aValue);
00142
00144 int getUnsigned(RMAttribute aName, unsigned long aID, unsigned long & aValue);
00145
00147 int getString(RMAttribute aName, unsigned long aID, char * & aBuf);
00148
00150 int getBinary(RMAttribute aName, unsigned long aID, char * & aBuf, unsigned long & aLength);
00151
00153 int setString(RMAttribute aName, unsigned long aID, char * aBuf);
00154
00156 int setUnsigned(RMAttribute aName, unsigned long aID, unsigned long aValue);
00157
00158 private:
00159
00161 int SearchAndReadLog(enum SearchOption aMethod, unsigned long aID, unsigned long & aNextID);
00162
00164 string mLogFilePath;
00165
00167 posix_logd_t mLog;
00168
00170 unsigned long mDefaultQuery;
00171
00173 EventLog mLastEntry;
00174
00175 eventQuery * mEventQuery;
00176 };
00177
00178
00179 #endif // __eventLog_h__