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"/>
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"/>
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;}
38 : _Type(TSupportedParamType::invalid_val)
41 TParamValue(uint32 value)
43 _Type = TSupportedParamType::spt_uint32;
47 TParamValue(uint64 value)
49 _Type = TSupportedParamType::spt_uint64;
53 TParamValue(bool value)
55 _Type = TSupportedParamType::spt_uint32;
56 _UInt32Val = value ? 1 : 0;
59 TParamValue(sint32 value)
61 _Type = TSupportedParamType::spt_sint32;
65 TParamValue(float value)
67 _Type = TSupportedParamType::spt_float;
71 TParamValue(const std::string &value)
73 _Type = TSupportedParamType::spt_string;
77 TParamValue(const NLMISC::CEntityId &value)
79 _Type = TSupportedParamType::spt_entityId;
83 TParamValue(const NLMISC::CSheetId &value)
85 _Type = TSupportedParamType::spt_sheetId;
89 TParamValue(INVENTORIES::TItemId itemId)
91 _Type = TSupportedParamType::spt_itemId;
95 TParamValue &operator = (const TParamValue &other)
99 switch (_Type.getValue())
101 case TSupportedParamType::spt_uint32:
102 _UInt32Val = other._UInt32Val;
104 case TSupportedParamType::spt_uint64:
105 _UInt64Val = other._UInt64Val;
107 case TSupportedParamType::spt_sint32:
108 _SInt32Val = other._SInt32Val;
110 case TSupportedParamType::spt_float:
111 _FloatVal = other._FloatVal;
113 case TSupportedParamType::spt_string:
114 _StringVal = other._StringVal;
116 case TSupportedParamType::spt_entityId:
117 _EntityId = other._EntityId;
119 case TSupportedParamType::spt_sheetId:
120 _SheetId = other._SheetId;
122 case TSupportedParamType::spt_itemId:
123 _ItemId = other._ItemId;
132 void serial(NLMISC::IStream &s)
138 switch (_Type.getValue())
140 case TSupportedParamType::spt_uint32:
141 s.serial(_UInt32Val);
143 case TSupportedParamType::spt_uint64:
144 s.serial(_UInt64Val);
146 case TSupportedParamType::spt_sint32:
147 s.serial(_SInt32Val);
149 case TSupportedParamType::spt_float:
152 case TSupportedParamType::spt_string:
153 s.serial(_StringVal);
155 case TSupportedParamType::spt_entityId:
158 case TSupportedParamType::spt_sheetId:
161 case TSupportedParamType::spt_itemId:
169 std::string toString() const
171 switch (_Type.getValue())
173 case TSupportedParamType::spt_uint32:
174 return NLMISC::toString(_UInt32Val);
176 case TSupportedParamType::spt_uint64:
177 return NLMISC::toString(_UInt64Val);
179 case TSupportedParamType::spt_sint32:
180 return NLMISC::toString(_SInt32Val);
182 case TSupportedParamType::spt_float:
183 return NLMISC::toString(_FloatVal);
185 case TSupportedParamType::spt_string:
188 case TSupportedParamType::spt_entityId:
189 return _EntityId.toString();
191 case TSupportedParamType::spt_sheetId:
192 return _SheetId.toString();
194 case TSupportedParamType::spt_itemId:
195 return NLMISC::toString(_ItemId);
204 TSupportedParamType getType() const
209 uint32 get_uint32() const
211 nlassert(_Type == TSupportedParamType::spt_uint32);
214 uint64 get_uint64() const
216 nlassert(_Type == TSupportedParamType::spt_uint64);
219 sint32 get_sint32() const
221 nlassert(_Type == TSupportedParamType::spt_sint32);
224 float get_float() const
226 nlassert(_Type == TSupportedParamType::spt_float);
229 const std::string &get_string() const
231 nlassert(_Type == TSupportedParamType::spt_string);
234 const NLMISC::CEntityId &get_entityId() const
236 nlassert(_Type == TSupportedParamType::spt_entityId);
239 const NLMISC::CSheetId &get_sheetId() const
241 nlassert(_Type == TSupportedParamType::spt_sheetId);
244 const INVENTORIES::TItemId &get_itemId() const
246 nlassert(_Type == TSupportedParamType::spt_itemId);
251 const uint32 &get(const uint32 *typeTag) const
253 nlassert(_Type == TSupportedParamType::spt_uint32);
257 const uint64 &get(const uint64 *typeTag) const
259 nlassert(_Type == TSupportedParamType::spt_uint64);
263 const sint32 &get(const sint32 *typeTag) const
265 nlassert(_Type == TSupportedParamType::spt_sint32);
269 const float &get(const float *typeTag) const
271 nlassert(_Type == TSupportedParamType::spt_float);
275 const std::string &get(const std::string *typeTag) const
277 nlassert(_Type == TSupportedParamType::spt_string);
281 const NLMISC::CEntityId &get(const NLMISC::CEntityId *typeTag) const
283 nlassert(_Type == TSupportedParamType::spt_entityId);
287 const NLMISC::CSheetId &get(const NLMISC::CSheetId *typeTag) const
289 nlassert(_Type == TSupportedParamType::spt_sheetId);
293 const INVENTORIES::TItemId &get(const INVENTORIES::TItemId *typeTag) const
295 nlassert(_Type == TSupportedParamType::spt_itemId);
299 bool operator == (const TParamValue &other) const
301 if (_Type != other._Type)
304 switch (_Type.getValue())
306 case TSupportedParamType::spt_uint32:
307 return _UInt32Val == other._UInt32Val;
309 case TSupportedParamType::spt_uint64:
310 return _UInt64Val == other._UInt64Val;
312 case TSupportedParamType::spt_sint32:
313 return _SInt32Val == other._SInt32Val;
315 case TSupportedParamType::spt_float:
316 return _FloatVal == other._FloatVal;
318 case TSupportedParamType::spt_string:
319 return _StringVal == other._StringVal;
321 case TSupportedParamType::spt_entityId:
322 return _EntityId == other._EntityId;
324 case TSupportedParamType::spt_sheetId:
325 return _SheetId == other._SheetId;
327 case TSupportedParamType::spt_itemId:
328 return _ItemId == other._ItemId;
335 bool operator < (const TParamValue &other) const
337 if (_Type != other._Type)
340 switch (_Type.getValue())
342 case TSupportedParamType::spt_uint32:
343 return _UInt32Val < other._UInt32Val;
345 case TSupportedParamType::spt_uint64:
346 return _UInt64Val < other._UInt64Val;
348 case TSupportedParamType::spt_sint32:
349 return _SInt32Val < other._SInt32Val;
351 case TSupportedParamType::spt_float:
352 return _FloatVal < other._FloatVal;
354 case TSupportedParamType::spt_string:
355 return _StringVal < other._StringVal;
357 case TSupportedParamType::spt_entityId:
358 return _EntityId < other._EntityId;
360 case TSupportedParamType::spt_sheetId:
361 return _SheetId < other._SheetId;
363 case TSupportedParamType::spt_itemId:
364 return _ItemId < other._ItemId;
372 TSupportedParamType _Type;
381 std::string _StringVal;
382 NLMISC::CEntityId _EntityId;
383 NLMISC::CSheetId _SheetId;
384 INVENTORIES::TItemId _ItemId;
390 <!-- ============================================================== -->
391 <class name="TParamDesc">
392 <doc line="Describe a param for a log entry"/>
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"/>
401 <!-- ============================================================== -->
402 <class name="TListParamValues">
403 <doc line="A vector of parameter value"/>
407 <property type="std::list < TParamValue >" name="Params" byref="true" serial="Cont"/>
411 <!-- ============================================================== -->
412 <class name="TLogDefinition">
413 <doc line="Definition of a log entry"/>
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 < TParamDesc >" name="Params" byref="true" serial="Cont"/>
425 <property type="std::vector < TParamDesc >" name="ListParams" byref="true" serial="Cont"/>
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"/>
436 <property type="std::string" name="LogName"/>
437 <property type="uint32" name="TimeStamp"/>
439 <property type="std::vector < TParamValue >" name="Params" byref="true" serial="Cont"/>
440 <property type="std::vector < TListParamValues >" name="ListParams" byref="true" serial="Cont"/>
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 < TLogDefinition >" name="logDef" byref="true" serial="Cont"/>
459 <!-- ========================================================== -->
460 <method name="reportLog" msg="LG">
461 <doc line="A client send a log"/>
463 <param type="std::vector < TLogInfo >" name="logInfos" byref="true" serial="Cont"/>