libstp
Robotics library for Botball
Loading...
Searching...
No Matches
PortRegistry.hpp
Go to the documentation of this file.
1
#pragma once
2
3
#ifdef SAFETY_CHECKS_ENABLED
4
#include <mutex>
5
#include <set>
6
#endif
7
8
namespace
libstp::hal::detail
9
{
10
#ifdef SAFETY_CHECKS_ENABLED
20
class
PortRegistry
21
{
22
public
:
24
bool
tryRegister(
int
port)
25
{
26
std::lock_guard lock(mu_);
27
return
used_.insert(port).second;
28
}
29
30
void
unregister(
int
port)
31
{
32
std::lock_guard lock(mu_);
33
used_.erase(port);
34
}
35
36
private
:
37
std::mutex mu_;
38
std::set<int> used_;
39
};
40
#endif
41
}
libstp::hal::detail
Definition
PortRegistry.hpp:9
modules
libstp-hal
include
hal
PortRegistry.hpp
Generated by
1.15.0