summaryrefslogtreecommitdiff
path: root/Servers/ProtocolServer/Protocol.cpp
blob: 7d29458eb56d2dfdc5709f2ec412836320f585ef (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
#include <AK/HashMap.h>
#include <ProtocolServer/Protocol.h>

static HashMap<String, Protocol*>& all_protocols()
{
    static HashMap<String, Protocol*> map;
    return map;
}

Protocol* Protocol::find_by_name(const String& name)
{
    return all_protocols().get(name).value_or(nullptr);
}

Protocol::Protocol(const String& name)
{
    all_protocols().set(name, this);
}

Protocol::~Protocol()
{
    ASSERT_NOT_REACHED();
}