aboutsummaryrefslogtreecommitdiffstats
path: root/library/cpp/lwtrace/event.h
blob: e53a620c456defaf201bdeb60918ac7673227f3c (plain) (blame)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
#pragma once

#include "preprocessor.h"
#include "signature.h"
#include "param_traits.h"

#include <library/cpp/lwtrace/protos/lwtrace.pb.h>

namespace NLWTrace {
    // Common class for all events
    struct TEvent {
        const char* Name;
        const char* Groups[LWTRACE_MAX_GROUPS + 1];
        TSignature Signature;

        const char* GetProvider() const {
            return Groups[0];
        }

        void ToProtobuf(TEventPb& pb) const {
            pb.SetName(Name);
            for (const char* const* gi = Groups; *gi != nullptr; gi++) {
                pb.AddGroups(*gi);
            }
            Signature.ToProtobuf(pb);
        }
    };

}