blob: a379b34ec0557b22f828df17b2020ce314ed78f9 (
plain) (
blame)
| 1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
 | #include "custom_action.h"
#include "control.h"
using namespace NLWTrace;
TCustomActionExecutor* TCustomActionFactory::Create(TProbe* probe, const TCustomAction& action, TSession* trace) const {
    auto iter = Callbacks.find(action.GetName());
    if (iter != Callbacks.end()) {
        return iter->second(probe, action, trace);
    } else {
        return nullptr;
    }
}
void TCustomActionFactory::Register(const TString& name, const TCustomActionFactory::TCallback& callback) {
    if (Callbacks.contains(name)) {
        ythrow yexception() << "duplicate custom action '" << name << "'";
    }
    Callbacks[name] = callback;
}
 |