mirror of
https://github.com/eclipse-openvehicle-api/openvehicle-api.git
synced 2026-08-30 12:15:12 +00:00
connection between 2 systems and bug fixes (#14)
This commit is contained in:
47
sdv_services/uds_win_tunnel/watchdog.h
Normal file
47
sdv_services/uds_win_tunnel/watchdog.h
Normal file
@@ -0,0 +1,47 @@
|
||||
/********************************************************************************
|
||||
* Copyright (c) 2025-2026 ZF Friedrichshafen AG
|
||||
*
|
||||
* This program and the accompanying materials are made available under the
|
||||
* terms of the Apache License Version 2.0 which is available at
|
||||
* https://www.apache.org/licenses/LICENSE-2.0
|
||||
*
|
||||
* SPDX-License-Identifier: Apache-2.0
|
||||
*
|
||||
* Contributors:
|
||||
* Denisa Ros - initial API and implementation
|
||||
********************************************************************************/
|
||||
|
||||
#ifdef _WIN32
|
||||
#ifndef UDS_WIN_TUNNEL_WATCHDOG_H
|
||||
#define UDS_WIN_TUNNEL_WATCHDOG_H
|
||||
|
||||
#include <map>
|
||||
#include <memory>
|
||||
#include <mutex>
|
||||
|
||||
class CWinTunnelConnectionWatchDog
|
||||
{
|
||||
public:
|
||||
template<typename T>
|
||||
void AddConnection(const std::shared_ptr<T>& connection)
|
||||
{
|
||||
if (!connection)
|
||||
{
|
||||
return;
|
||||
}
|
||||
|
||||
AddConnectionImpl(std::static_pointer_cast<void>(connection));
|
||||
}
|
||||
|
||||
void RemoveConnection(const void* connection);
|
||||
void Clear();
|
||||
|
||||
private:
|
||||
void AddConnectionImpl(const std::shared_ptr<void>& connection);
|
||||
|
||||
std::mutex m_Mutex;
|
||||
std::map<const void*, std::shared_ptr<void>> m_Connections;
|
||||
};
|
||||
|
||||
#endif // UDS_WIN_TUNNEL_WATCHDOG_H
|
||||
#endif // _WIN32
|
||||
Reference in New Issue
Block a user