Go to the documentation of this file.00001 #ifndef logging_logging_tssstorage_H
00002 #define logging_logging_tssstorage_H
00003
00004
00005
00006
00007
00008
00009
00010
00011
00012
00013
00014
00015
00016
00017
00018
00019
00020
00021
00022
00023
00024
00025
00026
00027
00028
00029
00030
00031 #ifndef __cplusplus
00032 #error This is a C++ include file and cannot be used from plain C
00033 #endif
00034
00035 #include <ace/Hash_Map_Manager.h>
00036 #include <ace/Task.h>
00037
00038 class LoggingTSSStorage
00039 {
00040 public:
00041 LoggingTSSStorage() : m_threadName(0),
00042 tmpStr((size_t)512)
00043 {
00044 m_ldata.open(3);
00045 m_attributes.open(3);
00046 clear();
00047 }
00048
00049 ~LoggingTSSStorage()
00050 {
00051 if (m_threadName)
00052 {
00053 delete[] m_threadName;
00054 m_threadName = 0;
00055 }
00056 m_ldata.close();
00057 m_attributes.close();
00058 }
00059
00060 void clear()
00061 {
00062 m_logEntryType = 0;
00063 m_routine = 0;
00064 m_file = 0;
00065 m_line = 0UL;
00066 sourceObject_m = 0;
00067 audience_m = 0;
00068 array_m = 0;
00069 antenna_m = 0;
00070 m_lflags = 0;
00071 m_stackId = 0;
00072 m_stackLevel = 0;
00073 m_context = 0;
00074 m_uri = 0;
00075 m_logId = 0;
00076 m_host = 0;
00077 m_privateFlags = 0;
00078 logLevelLocalType_m = 6;
00079 logLevelRemoteType_m = 6;
00080 m_ldata.unbind_all();
00081 m_attributes.unbind_all();
00082 }
00083
00084 void resetAttributes() { m_attributes.unbind_all(); };
00085
00086 const ACE_TCHAR * routine() { return m_routine; };
00087 void routine(const ACE_TCHAR * routine) { m_routine=routine; };
00088
00089 const ACE_TCHAR * file() { return m_file; };
00090 void file(const ACE_TCHAR * fileName) { m_file=fileName; };
00091
00092 const unsigned long line() { return m_line; };
00093 void line(unsigned long lineNumber) { m_line=lineNumber; };
00094
00095 const ACE_TCHAR *
00096 sourceObject() { return sourceObject_m; };
00097
00098 void
00099 sourceObject(const ACE_TCHAR * soName) { sourceObject_m = soName; };
00100
00101 const ACE_TCHAR *
00102 audience() { return audience_m; };
00103
00104 void
00105 audience(const ACE_TCHAR * soName) { audience_m = soName; };
00106
00107 const ACE_TCHAR *
00108 array() { return array_m; };
00109
00110 void
00111 array(const ACE_TCHAR * soName) { array_m = soName; };
00112
00113 const ACE_TCHAR *
00114 antenna() { return antenna_m; };
00115
00116 void
00117 antenna(const ACE_TCHAR * soName) { antenna_m = soName; };
00118
00119 unsigned int flags() { return m_lflags; };
00120 void flags(unsigned int flags) { m_lflags=flags; };
00121
00122 const ACE_TCHAR * threadName() { return m_threadName; };
00123 void threadName(const ACE_TCHAR * name)
00124 {
00125 if (m_threadName)
00126 {
00127 delete[] m_threadName;
00128 m_threadName = 0;
00129 }
00130
00131 if (name)
00132 {
00133 m_threadName = new ACE_TCHAR[ACE_OS::strlen(name)+1];
00134 ACE_OS::strcpy(m_threadName, name);
00135 }
00136 };
00137
00138 const ACE_TCHAR * logEntryType() { return m_logEntryType; };
00139 void logEntryType(const ACE_TCHAR * logEntryType) { m_logEntryType=logEntryType; };
00140
00141 const ACE_TCHAR * context() { return m_context; };
00142 void context(const ACE_TCHAR * context) { m_context=context; };
00143
00144 int stackLevel() { return m_stackLevel; };
00145 void stackLevel(int stackLevel) { m_stackLevel=stackLevel; };
00146
00147 const ACE_TCHAR * stackId() { return m_stackId; };
00148 void stackId(const ACE_TCHAR * stackId) { m_stackId=stackId; };
00149
00150 const ACE_TCHAR * logId() { return m_logId; };
00151 void logId(const ACE_TCHAR * logId) { m_logId=logId; };
00152
00153 const ACE_TCHAR * uri() { return m_uri; };
00154 void uri(const ACE_TCHAR * uri) { m_uri=uri; };
00155
00156 const ACE_TCHAR * host() { return m_host; };
00157 void host(const ACE_TCHAR * host) { m_host=host; };
00158
00159 int privateFlags() { return m_privateFlags; };
00160 void privateFlags(int privateFlags) { m_privateFlags=privateFlags; };
00161
00162 int logLevelLocalType() { return logLevelLocalType_m; };
00163 void logLevelLocalType(int logLevelLocalType) { logLevelLocalType_m=logLevelLocalType; };
00164
00165 int logLevelRemoteType() { return logLevelRemoteType_m; };
00166 void logLevelRemoteType(int logLevelRemoteType) { logLevelRemoteType_m=logLevelRemoteType; };
00167 typedef ACE_Hash_Map_Manager <ACE_CString, ACE_CString, ACE_Thread_Mutex> HASH_MAP;
00168 typedef ACE_Hash_Map_Iterator <ACE_CString, ACE_CString, ACE_Thread_Mutex> HASH_MAP_ITER;
00169 typedef ACE_Hash_Map_Entry <ACE_CString, ACE_CString> HASH_MAP_ENTRY;
00170
00171 void addAttribute(const ACE_TCHAR * name, const ACE_TCHAR * value)
00172 {
00173 m_attributes.bind(name, value);
00174 };
00175
00176 void addData(const ACE_TCHAR * name, const ACE_TCHAR * value)
00177 {
00178 m_ldata.bind(name, value);
00179 };
00180
00181 HASH_MAP_ITER getAttributes() {
00182 return HASH_MAP_ITER(m_attributes);
00183 };
00184
00185 HASH_MAP_ITER getData() {
00186 return HASH_MAP_ITER(m_ldata);
00187 };
00188
00189 ACE_CString& getTmpStr(){
00190 return tmpStr;
00191 }
00192 private:
00193
00194 ACE_TCHAR * m_threadName;
00195
00196 const ACE_TCHAR * m_logEntryType;
00197 const ACE_TCHAR * m_routine;
00198 const ACE_TCHAR * m_file;
00199 unsigned long m_line;
00200 const ACE_TCHAR * sourceObject_m;
00201 const ACE_TCHAR * audience_m;
00202 const ACE_TCHAR * array_m;
00203 const ACE_TCHAR * antenna_m;
00204 unsigned int m_lflags;
00205 const ACE_TCHAR * m_stackId;
00206 int m_stackLevel;
00207 const ACE_TCHAR * m_context;
00208 const ACE_TCHAR * m_logId;
00209 const ACE_TCHAR * m_uri;
00210 const ACE_TCHAR * m_host;
00211
00212
00213
00214
00215 int m_privateFlags;
00216 int logLevelLocalType_m;
00217 int logLevelRemoteType_m;
00218
00219 LoggingTSSStorage::HASH_MAP m_ldata;
00220 LoggingTSSStorage::HASH_MAP m_attributes;
00221
00222 ACE_CString tmpStr;
00223 };
00224
00225
00226 #endif