Add infos into target window
[ryzomcore.git] / ryzom / server / src / server_share / logger_service_itf.xml
blob814f996e603f47bfbbdedc35536f9c6ac095e6f9
1 <generator header_tag="LOGGER_SERVICE_ITF">
2         <include file="nel/misc/entity_id.h"/>
3         <include file="nel/misc/sheet_id.h"/>
4         <include file="inventories.h"/>
5         <sys-include file="vector"/>
6         <cpp-include file="stdpch.h"/>
8         <namespace name="LGS">
10                 <!-- ============================================================== -->
11                 <enum name="TSupportedParamType">
12                         <item name="spt_uint32"/>
13                         <item name="spt_uint64"/>
14                         <item name="spt_sint32"/>
15                         <item name="spt_float"/>
16                         <item name="spt_string"/>
17                         <item name="spt_entityId"/>
18                         <item name="spt_sheetId"/>
19                         <item name="spt_itemId"/>
20                 </enum>
22                 <verbatim_header>
23 <![CDATA[
25 //      template <class T>      LGS::TSupportedParamType getParamType();
26 //      template <class T>      LGS::TSupportedParamType getParamType<uint32>() { return LGS::TSupportedParamType::spt_uint32;}
27 //      template <class T>      LGS::TSupportedParamType getParamType<uint64>() { return LGS::TSupportedParamType::spt_uint64;}
28 //      template <class T>      LGS::TSupportedParamType getParamType<sint32>() { return LGS::TSupportedParamType::spt_sint32;}
29 //      template <class T>      LGS::TSupportedParamType getParamType<float>() { return LGS::TSupportedParamType::spt_float;}
30 //      template <class T>      LGS::TSupportedParamType getParamType<std::string>() { return LGS::TSupportedParamType::spt_string;}
31 //      template <class T>      LGS::TSupportedParamType getParamType<NLMISC::CEntityId>() { return LGS::TSupportedParamType::spt_entityId;}
32 //      template <class T>      LGS::TSupportedParamType getParamType<NLMISC::CSheetId>() { return LGS::TSupportedParamType::spt_sheetId;}
33 //      template <class T>      LGS::TSupportedParamType getParamType<INVENTORIES::TItemId>() { return LGS::TSupportedParamType::spt_itemId;}
35         struct TParamValue
36         {
37                 TParamValue()
38                         :       _Type(TSupportedParamType::invalid_val)
39                 {}
41                 TParamValue(uint32 value)
42                 {
43                         _Type = TSupportedParamType::spt_uint32;
44                         _UInt32Val = value;
45                 }
47                 TParamValue(uint64 value)
48                 {
49                         _Type = TSupportedParamType::spt_uint64;
50                         _UInt64Val = value;
51                 }
53                 TParamValue(bool value)
54                 {
55                         _Type = TSupportedParamType::spt_uint32;
56                         _UInt32Val = value ? 1 : 0;
57                 }
59                 TParamValue(sint32 value)
60                 {
61                         _Type = TSupportedParamType::spt_sint32;
62                         _SInt32Val = value;
63                 }
65                 TParamValue(float value)
66                 {
67                         _Type = TSupportedParamType::spt_float;
68                         _FloatVal = value;
69                 }
71                 TParamValue(const std::string &value)
72                 {
73                         _Type = TSupportedParamType::spt_string;
74                         _StringVal = value;
75                 }
77                 TParamValue(const NLMISC::CEntityId &value)
78                 {
79                         _Type = TSupportedParamType::spt_entityId;
80                         _EntityId = value;
81                 }
83                 TParamValue(const NLMISC::CSheetId &value)
84                 {
85                         _Type = TSupportedParamType::spt_sheetId;
86                         _SheetId = value;
87                 }
89                 TParamValue(INVENTORIES::TItemId itemId)
90                 {
91                         _Type = TSupportedParamType::spt_itemId;
92                         _ItemId = itemId;
93                 }
95                 TParamValue &operator = (const TParamValue &other)
96                 {
97                         _Type = other._Type;
99                         switch (_Type.getValue())
100                         {
101                         case TSupportedParamType::spt_uint32:
102                                 _UInt32Val = other._UInt32Val;
103                                 break;
104                         case TSupportedParamType::spt_uint64:
105                                 _UInt64Val = other._UInt64Val;
106                                 break;
107                         case TSupportedParamType::spt_sint32:
108                                 _SInt32Val = other._SInt32Val;
109                                 break;
110                         case TSupportedParamType::spt_float:
111                                 _FloatVal = other._FloatVal;
112                                 break;
113                         case TSupportedParamType::spt_string:
114                                 _StringVal = other._StringVal;
115                                 break;
116                         case TSupportedParamType::spt_entityId:
117                                 _EntityId = other._EntityId;
118                                 break;
119                         case TSupportedParamType::spt_sheetId:
120                                 _SheetId = other._SheetId;
121                                 break;
122                         case TSupportedParamType::spt_itemId:
123                                 _ItemId = other._ItemId;
124                                 break;
125                         default:
126                                 nlstop;
127                         };
129                         return *this;
130                 }
132                 void serial(NLMISC::IStream &s)
133                 {
134                         // read the type 
135                         s.serial(_Type);
137                         // serial the value
138                         switch (_Type.getValue())
139                         {
140                         case TSupportedParamType::spt_uint32:
141                                 s.serial(_UInt32Val);
142                                 break;
143                         case TSupportedParamType::spt_uint64:
144                                 s.serial(_UInt64Val);
145                                 break;
146                         case TSupportedParamType::spt_sint32:
147                                 s.serial(_SInt32Val);
148                                 break;
149                         case TSupportedParamType::spt_float:
150                                 s.serial(_FloatVal);
151                                 break;
152                         case TSupportedParamType::spt_string:
153                                 s.serial(_StringVal);
154                                 break;
155                         case TSupportedParamType::spt_entityId:
156                                 s.serial(_EntityId);
157                                 break;
158                         case TSupportedParamType::spt_sheetId:
159                                 s.serial(_SheetId);
160                                 break;
161                         case TSupportedParamType::spt_itemId:
162                                 s.serial(_ItemId);
163                                 break;
164                         default:
165                                 nlstop;
166                         };
167                 }
169                 std::string toString() const
170                 {
171                         switch (_Type.getValue())
172                         {
173                         case TSupportedParamType::spt_uint32:
174                                 return NLMISC::toString(_UInt32Val);
175                                 break;
176                         case TSupportedParamType::spt_uint64:
177                                 return NLMISC::toString(_UInt64Val);
178                                 break;
179                         case TSupportedParamType::spt_sint32:
180                                 return NLMISC::toString(_SInt32Val);
181                                 break;
182                         case TSupportedParamType::spt_float:
183                                 return NLMISC::toString(_FloatVal);
184                                 break;
185                         case TSupportedParamType::spt_string:
186                                 return _StringVal;
187                                 break;
188                         case TSupportedParamType::spt_entityId:
189                                 return _EntityId.toString();
190                                 break;
191                         case TSupportedParamType::spt_sheetId:
192                                 return _SheetId.toString();
193                                 break;
194                         case TSupportedParamType::spt_itemId:
195                                 return NLMISC::toString(_ItemId);
196                                 break;
197                         default:
198                                 nlstop;
200                                 return "";
201                         };
202                 }
204                 TSupportedParamType getType() const
205                 {
206                         return _Type;
207                 }
209                 uint32 get_uint32() const
210                 {
211                         nlassert(_Type == TSupportedParamType::spt_uint32);
212                         return _UInt32Val;
213                 }
214                 uint64 get_uint64() const
215                 {
216                         nlassert(_Type == TSupportedParamType::spt_uint64);
217                         return _UInt64Val;
218                 }
219                 sint32 get_sint32() const
220                 {
221                         nlassert(_Type == TSupportedParamType::spt_sint32);
222                         return _SInt32Val;
223                 }
224                 float get_float() const
225                 {
226                         nlassert(_Type == TSupportedParamType::spt_float);
227                         return _FloatVal;
228                 }
229                 const std::string &get_string() const
230                 {
231                         nlassert(_Type == TSupportedParamType::spt_string);
232                         return _StringVal;
233                 }
234                 const NLMISC::CEntityId &get_entityId() const
235                 {
236                         nlassert(_Type == TSupportedParamType::spt_entityId);
237                         return _EntityId;
238                 }
239                 const NLMISC::CSheetId &get_sheetId() const
240                 {
241                         nlassert(_Type == TSupportedParamType::spt_sheetId);
242                         return _SheetId;
243                 }
244                 const INVENTORIES::TItemId &get_itemId() const
245                 {
246                         nlassert(_Type == TSupportedParamType::spt_itemId);
247                         return _ItemId;
248                 }
251                 const uint32 &get(const uint32 *typeTag) const
252                 {
253                         nlassert(_Type == TSupportedParamType::spt_uint32);
254                         return _UInt32Val;
255                 }
257                 const uint64 &get(const uint64 *typeTag) const
258                 {
259                         nlassert(_Type == TSupportedParamType::spt_uint64);
260                         return _UInt64Val;
261                 }
263                 const sint32 &get(const sint32 *typeTag) const
264                 {
265                         nlassert(_Type == TSupportedParamType::spt_sint32);
266                         return _SInt32Val;
267                 }
269                 const float &get(const float *typeTag) const
270                 {
271                         nlassert(_Type == TSupportedParamType::spt_float);
272                         return _FloatVal;
273                 }
275                 const std::string &get(const std::string *typeTag) const
276                 {
277                         nlassert(_Type == TSupportedParamType::spt_string);
278                         return _StringVal;
279                 }
281                 const NLMISC::CEntityId &get(const NLMISC::CEntityId *typeTag) const
282                 {
283                         nlassert(_Type == TSupportedParamType::spt_entityId);
284                         return _EntityId;
285                 }
287                 const NLMISC::CSheetId &get(const NLMISC::CSheetId *typeTag) const
288                 {
289                         nlassert(_Type == TSupportedParamType::spt_sheetId);
290                         return _SheetId;
291                 }
293                 const INVENTORIES::TItemId &get(const INVENTORIES::TItemId *typeTag) const
294                 {
295                         nlassert(_Type == TSupportedParamType::spt_itemId);
296                         return _ItemId;
297                 }
299                 bool operator == (const TParamValue &other) const
300                 {
301                         if (_Type != other._Type)
302                                 return false;
304                         switch (_Type.getValue())
305                         {
306                         case TSupportedParamType::spt_uint32:
307                                 return _UInt32Val == other._UInt32Val;
308                                 break;
309                         case TSupportedParamType::spt_uint64:
310                                 return _UInt64Val == other._UInt64Val;
311                                 break;
312                         case TSupportedParamType::spt_sint32:
313                                 return _SInt32Val == other._SInt32Val;
314                                 break;
315                         case TSupportedParamType::spt_float:
316                                 return _FloatVal == other._FloatVal;
317                                 break;
318                         case TSupportedParamType::spt_string:
319                                 return _StringVal == other._StringVal;
320                                 break;
321                         case TSupportedParamType::spt_entityId:
322                                 return _EntityId == other._EntityId;
323                                 break;
324                         case TSupportedParamType::spt_sheetId:
325                                 return _SheetId == other._SheetId;
326                                 break;
327                         case TSupportedParamType::spt_itemId:
328                                 return _ItemId == other._ItemId;
329                                 break;
330                         default:
331                                 return false;;
332                         };
333                 }
335                 bool operator < (const TParamValue &other) const
336                 {
337                         if (_Type != other._Type)
338                                 return false;
340                         switch (_Type.getValue())
341                         {
342                         case TSupportedParamType::spt_uint32:
343                                 return _UInt32Val < other._UInt32Val;
344                                 break;
345                         case TSupportedParamType::spt_uint64:
346                                 return _UInt64Val < other._UInt64Val;
347                                 break;
348                         case TSupportedParamType::spt_sint32:
349                                 return _SInt32Val < other._SInt32Val;
350                                 break;
351                         case TSupportedParamType::spt_float:
352                                 return _FloatVal < other._FloatVal;
353                                 break;
354                         case TSupportedParamType::spt_string:
355                                 return _StringVal < other._StringVal;
356                                 break;
357                         case TSupportedParamType::spt_entityId:
358                                 return _EntityId < other._EntityId;
359                                 break;
360                         case TSupportedParamType::spt_sheetId:
361                                 return _SheetId < other._SheetId;
362                                 break;
363                         case TSupportedParamType::spt_itemId:
364                                 return _ItemId < other._ItemId;
365                                 break;
366                         default:
367                                 return false;;
368                         };
369                 }
371         private:
372                 TSupportedParamType     _Type;
374                 union
375                 {
376                         uint32          _UInt32Val;
377                         uint64          _UInt64Val;
378                         sint32          _SInt32Val;
379                         float           _FloatVal;
380                 };
381                 std::string                             _StringVal;
382                 NLMISC::CEntityId               _EntityId;
383                 NLMISC::CSheetId                _SheetId;
384                 INVENTORIES::TItemId    _ItemId;
385         };
388                 </verbatim_header>
390                 <!-- ============================================================== -->
391                 <class name="TParamDesc">
392                         <doc line="Describe a param for a log entry"/>
394                         <serial/>
396                         <property type="std::string"            name="Name"     byref="true" doc="Name of the parameter"/>
397                         <property type="TSupportedParamType" name="Type"        enum="smart" doc="Type of the parameter"/>
398                         <property type="bool"                           name="List"     default="false" doc="Flag indicating that this parameter is a list"/>
399                 </class>
401                 <!-- ============================================================== -->
402                 <class name="TListParamValues">
403                         <doc line="A vector of parameter value"/>
405                         <serial/>
407                         <property type="std::list &lt; TParamValue &gt;"                name="Params"   byref="true" serial="Cont"/>
408                 </class>
411                 <!-- ============================================================== -->
412                 <class name="TLogDefinition">
413                         <doc line="Definition of a log entry"/>
415                         <serial/>
417                         <property type="std::string"    name="LogName"  
418                                 doc="The name of the log, used to identify the log"/>
419                         <property type="bool"                   name="Context"  default="false" 
420                                 doc="This log is a context log"/>
421                         <property type="std::string"    name="LogText"  
422                                 doc="The textual content of the log, contains '__CLOSE_CONTEXT__' to close a log context"/>
424                         <property type="std::vector &lt; TParamDesc &gt;"       name="Params" byref="true" serial="Cont"/>
425                         <property type="std::vector &lt; TParamDesc &gt;"       name="ListParams" byref="true" serial="Cont"/>
427                 </class>
429                 <!-- ============================================================== -->
430                 <class name="TLogInfo">
431                         <doc line="A log entry data. This contains the parameter of a log "/>
432                         <doc line="entry to be stored in the log archive"/>
434                         <serial/>
436                         <property type="std::string" name="LogName"/>
437                         <property type="uint32"         name="TimeStamp"/>
439                         <property type="std::vector &lt; TParamValue &gt;"              name="Params"           byref="true" serial="Cont"/>
440                         <property type="std::vector &lt; TListParamValues &gt;" name="ListParams"       byref="true" serial="Cont"/>
442                 </class>
444                 <!-- ============================================================== -->
445                 <!-- ============================================================== -->
446                 <!-- ============================================================== -->
447                 <module_interface name="CLoggerService" module_class='"LoggerService"'>
449                         <!-- ========================================================== -->
450                         <method name="registerClient" msg="RC">
451                                 <doc line="A logger client register itself wy providing it's definition of "/>
452                                 <doc line="the log content. It is mandatory that ALL client share"/>
453                                 <doc line="Exactly the same definition of log."/>
455                                 <param type="uint32" name="shardId"/>
456                                 <param type="std::vector &lt; TLogDefinition &gt;"              name="logDef" byref="true" serial="Cont"/>
457                         </method>
458                         
459                         <!-- ========================================================== -->
460                         <method name="reportLog" msg="LG">
461                                 <doc line="A client send a log"/>
463                                 <param type="std::vector &lt; TLogInfo &gt;" name="logInfos" byref="true" serial="Cont"/>
464                         </method>
465                 </module_interface>
467         </namespace>
468 </generator>