Lines Matching refs:eventBase

186 bool HiSysEvent::IsError(EventBase& eventBase)
188 return (eventBase.GetRetCode() < SUCCESS);
191 bool HiSysEvent::IsErrorAndUpdate(int retCode, EventBase& eventBase)
194 eventBase.SetRetCode(retCode);
200 bool HiSysEvent::IsWarnAndUpdate(int retCode, EventBase& eventBase)
203 eventBase.SetRetCode(retCode);
209 bool HiSysEvent::UpdateAndCheckKeyNumIsOver(EventBase& eventBase)
211 if (eventBase.GetParamCnt() >= MAX_PARAM_NUMBER) {
212 eventBase.SetRetCode(ERR_KEY_NUMBER_TOO_MUCH);
218 void HiSysEvent::SendSysEvent(EventBase& eventBase)
220 auto rawData = eventBase.GetEventRawData();
222 eventBase.SetRetCode(ERR_RAW_DATA_WROTE_EXCEPTION);
226 int r = Transport::GetInstance().SendData(*(eventBase.GetEventRawData()));
228 eventBase.SetRetCode(r);
233 void HiSysEvent::AppendHexData(EventBase& eventBase, const std::string& key, uint64_t value)
235 eventBase.AppendParam(std::make_shared<Encoded::UnsignedVarintEncodedParam<uint64_t>>(key, value));
238 void HiSysEvent::WritebaseInfo(EventBase& eventBase)
240 eventBase.WritebaseInfo();
243 void HiSysEvent::AppendInvalidParam(EventBase& eventBase, const HiSysEventParam& param)
245 eventBase.SetRetCode(ERR_VALUE_INVALID);
248 void HiSysEvent::AppendBoolParam(EventBase& eventBase, const HiSysEventParam& param)
250 if (!CheckParamValidity(eventBase, param.name)) {
253 eventBase.AppendParam(std::make_shared<Encoded::SignedVarintEncodedParam<bool>>(param.name, param.v.b));
256 void HiSysEvent::AppendInt8Param(EventBase& eventBase, const HiSysEventParam& param)
258 if (!CheckParamValidity(eventBase, param.name)) {
261 eventBase.AppendParam(std::make_shared<Encoded::SignedVarintEncodedParam<int8_t>>(param.name, param.v.i8));
264 void HiSysEvent::AppendUint8Param(EventBase& eventBase, const HiSysEventParam& param)
266 if (!CheckParamValidity(eventBase, param.name)) {
269 eventBase.AppendParam(std::make_shared<Encoded::UnsignedVarintEncodedParam<uint8_t>>(param.name, param.v.ui8));
272 void HiSysEvent::AppendInt16Param(EventBase& eventBase, const HiSysEventParam& param)
274 if (!CheckParamValidity(eventBase, param.name)) {
277 eventBase.AppendParam(std::make_shared<Encoded::SignedVarintEncodedParam<int16_t>>(param.name, param.v.i16));
280 void HiSysEvent::AppendUint16Param(EventBase& eventBase, const HiSysEventParam& param)
282 if (!CheckParamValidity(eventBase, param.name)) {
285 eventBase.AppendParam(std::make_shared<Encoded::UnsignedVarintEncodedParam<uint16_t>>(param.name, param.v.ui16));
288 void HiSysEvent::AppendInt32Param(EventBase& eventBase, const HiSysEventParam& param)
290 if (!CheckParamValidity(eventBase, param.name)) {
293 eventBase.AppendParam(std::make_shared<Encoded::SignedVarintEncodedParam<int32_t>>(param.name, param.v.i32));
296 void HiSysEvent::AppendUint32Param(EventBase& eventBase, const HiSysEventParam& param)
298 if (!CheckParamValidity(eventBase, param.name)) {
301 eventBase.AppendParam(std::make_shared<Encoded::UnsignedVarintEncodedParam<uint32_t>>(param.name, param.v.ui32));
304 void HiSysEvent::AppendInt64Param(EventBase& eventBase, const HiSysEventParam& param)
306 if (!CheckParamValidity(eventBase, param.name)) {
309 eventBase.AppendParam(std::make_shared<Encoded::SignedVarintEncodedParam<int64_t>>(param.name, param.v.i64));
312 void HiSysEvent::AppendUint64Param(EventBase& eventBase, const HiSysEventParam& param)
314 if (!CheckParamValidity(eventBase, param.name)) {
317 eventBase.AppendParam(std::make_shared<Encoded::UnsignedVarintEncodedParam<uint64_t>>(param.name, param.v.ui64));
320 void HiSysEvent::AppendFloatParam(EventBase& eventBase, const HiSysEventParam& param)
322 if (!CheckParamValidity(eventBase, param.name)) {
325 eventBase.AppendParam(std::make_shared<Encoded::FloatingNumberEncodedParam<float>>(param.name, param.v.f));
328 void HiSysEvent::AppendDoubleParam(EventBase& eventBase, const HiSysEventParam& param)
330 if (!CheckParamValidity(eventBase, param.name)) {
333 eventBase.AppendParam(std::make_shared<Encoded::FloatingNumberEncodedParam<double>>(param.name, param.v.d));
336 void HiSysEvent::AppendStringParam(EventBase& eventBase, const HiSysEventParam& param)
339 eventBase.SetRetCode(ERR_VALUE_INVALID);
342 if (!CheckParamValidity(eventBase, param.name)) {
345 IsWarnAndUpdate(CheckValue(std::string(param.v.s)), eventBase);
347 eventBase.AppendParam(std::make_shared<Encoded::StringEncodedParam>(param.name, rawStr));
350 void HiSysEvent::AppendBoolArrayParam(EventBase& eventBase, const HiSysEventParam& param)
353 if (!CheckArrayValidity(eventBase, array)) {
357 if (!CheckArrayParamsValidity(eventBase, param.name, value)) {
360 eventBase.AppendParam(std::make_shared<Encoded::SignedVarintEncodedArrayParam<bool>>(param.name, value));
363 void HiSysEvent::AppendInt8ArrayParam(EventBase& eventBase, const HiSysEventParam& param)
366 if (!CheckArrayValidity(eventBase, array)) {
370 if (!CheckArrayParamsValidity(eventBase, param.name, value)) {
373 eventBase.AppendParam(std::make_shared<Encoded::SignedVarintEncodedArrayParam<int8_t>>(param.name, value));
376 void HiSysEvent::AppendUint8ArrayParam(EventBase& eventBase, const HiSysEventParam& param)
379 if (!CheckArrayValidity(eventBase, array)) {
383 if (!CheckArrayParamsValidity(eventBase, param.name, value)) {
386 eventBase.AppendParam(std::make_shared<Encoded::UnsignedVarintEncodedArrayParam<uint8_t>>(param.name, value));
389 void HiSysEvent::AppendInt16ArrayParam(EventBase& eventBase, const HiSysEventParam& param)
392 if (!CheckArrayValidity(eventBase, array)) {
396 if (!CheckArrayParamsValidity(eventBase, param.name, value)) {
399 eventBase.AppendParam(std::make_shared<Encoded::SignedVarintEncodedArrayParam<int16_t>>(param.name, value));
402 void HiSysEvent::AppendUint16ArrayParam(EventBase& eventBase, const HiSysEventParam& param)
405 if (!CheckArrayValidity(eventBase, array)) {
409 if (!CheckArrayParamsValidity(eventBase, param.name, value)) {
412 eventBase.AppendParam(std::make_shared<Encoded::UnsignedVarintEncodedArrayParam<uint16_t>>(param.name, value));
415 void HiSysEvent::AppendInt32ArrayParam(EventBase& eventBase, const HiSysEventParam& param)
418 if (!CheckArrayValidity(eventBase, array)) {
422 if (!CheckArrayParamsValidity(eventBase, param.name, value)) {
425 eventBase.AppendParam(std::make_shared<Encoded::SignedVarintEncodedArrayParam<int32_t>>(param.name, value));
428 void HiSysEvent::AppendUint32ArrayParam(EventBase& eventBase, const HiSysEventParam& param)
431 if (!CheckArrayValidity(eventBase, array)) {
435 if (!CheckArrayParamsValidity(eventBase, param.name, value)) {
438 eventBase.AppendParam(std::make_shared<Encoded::UnsignedVarintEncodedArrayParam<uint32_t>>(param.name, value));
441 void HiSysEvent::AppendInt64ArrayParam(EventBase& eventBase, const HiSysEventParam& param)
444 if (!CheckArrayValidity(eventBase, array)) {
448 if (!CheckArrayParamsValidity(eventBase, param.name, value)) {
451 eventBase.AppendParam(std::make_shared<Encoded::SignedVarintEncodedArrayParam<int64_t>>(param.name, value));
454 void HiSysEvent::AppendUint64ArrayParam(EventBase& eventBase, const HiSysEventParam& param)
457 if (!CheckArrayValidity(eventBase, array)) {
461 if (!CheckArrayParamsValidity(eventBase, param.name, value)) {
464 eventBase.AppendParam(std::make_shared<Encoded::UnsignedVarintEncodedArrayParam<uint64_t>>(param.name, value));
467 void HiSysEvent::AppendFloatArrayParam(EventBase& eventBase, const HiSysEventParam& param)
470 if (!CheckArrayValidity(eventBase, array)) {
474 if (!CheckArrayParamsValidity(eventBase, param.name, value)) {
477 eventBase.AppendParam(std::make_shared<Encoded::FloatingNumberEncodedArrayParam<float>>(param.name, value));
480 void HiSysEvent::AppendDoubleArrayParam(EventBase& eventBase, const HiSysEventParam& param)
483 if (!CheckArrayValidity(eventBase, array)) {
487 if (!CheckArrayParamsValidity(eventBase, param.name, value)) {
490 eventBase.AppendParam(std::make_shared<Encoded::FloatingNumberEncodedArrayParam<double>>(param.name, value));
493 void HiSysEvent::AppendStringArrayParam(EventBase& eventBase, const HiSysEventParam& param)
497 eventBase.SetRetCode(ERR_VALUE_INVALID);
502 eventBase.SetRetCode(ERR_VALUE_INVALID);
507 if (!CheckArrayParamsValidity(eventBase, param.name, value)) {
512 IsWarnAndUpdate(CheckValue(item), eventBase);
515 eventBase.AppendParam(std::make_shared<Encoded::StringEncodedArrayParam>(param.name, rawStrs));
518 void HiSysEvent::InnerWrite(EventBase& eventBase)
521 HILOG_DEBUG(LOG_CORE, "hisysevent inner writer result: %{public}d.", eventBase.GetRetCode());
524 void HiSysEvent::InnerWrite(EventBase& eventBase, const HiSysEventParam params[], size_t size)
530 AppendParam(eventBase, params[i]);
534 void HiSysEvent::AppendParam(EventBase& eventBase, const HiSysEventParam& param)
548 appendFuncs[paramType](eventBase, param);
550 eventBase.SetRetCode(ERR_VALUE_INVALID);