| 1 | // Copyright (C) Microsoft Corporation. All rights reserved. |
| 2 | |
| 3 | #pragma once |
| 4 | |
| 5 | #include "helpers.hpp" |
| 6 | #include <map> |
| 7 | #include <memory> |
| 8 | #include <wil/resource.h> |
| 9 | |
| 10 | class GnsRpcServer |
| 11 | { |
| 12 | public: |
| 13 | using AdapterCallback = std::function<HRESULT(LPCWSTR)>; |
| 14 | |
| 15 | GnsRpcServer(); |
| 16 | ~GnsRpcServer() noexcept; |
| 17 | |
| 18 | GnsRpcServer(const GnsRpcServer&) = delete; |
| 19 | GnsRpcServer& operator=(const GnsRpcServer&) = delete; |
| 20 | |
| 21 | GnsRpcServer(GnsRpcServer&&) noexcept; |
| 22 | GnsRpcServer& operator=(GnsRpcServer&&) noexcept; |
| 23 | |
| 24 | static std::shared_ptr<GnsRpcServer> GetOrCreate(); |
| 25 | |
| 26 | const UUID& GetServerUuid() const noexcept; |
| 27 | |
| 28 | private: |
| 29 | wil::srwlock m_lock; |
| 30 | bool m_moved = false; |
| 31 | UUID m_serverUuid{}; |
| 32 | }; |