event.h 666 B

1234567891011121314151617181920212223242526272829
  1. #pragma once
  2. #include "preprocessor.h"
  3. #include "signature.h"
  4. #include "param_traits.h"
  5. #include <library/cpp/lwtrace/protos/lwtrace.pb.h>
  6. namespace NLWTrace {
  7. // Common class for all events
  8. struct TEvent {
  9. const char* Name;
  10. const char* Groups[LWTRACE_MAX_GROUPS + 1];
  11. TSignature Signature;
  12. const char* GetProvider() const {
  13. return Groups[0];
  14. }
  15. void ToProtobuf(TEventPb& pb) const {
  16. pb.SetName(Name);
  17. for (const char* const* gi = Groups; *gi != nullptr; gi++) {
  18. pb.AddGroups(*gi);
  19. }
  20. Signature.ToProtobuf(pb);
  21. }
  22. };
  23. }