diff options
author | bulatman <bulatman@yandex-team.ru> | 2022-02-10 16:45:50 +0300 |
---|---|---|
committer | Daniil Cherednik <dcherednik@yandex-team.ru> | 2022-02-10 16:45:50 +0300 |
commit | 6560e4993b14d193f8c879e33a3de5e5eba6e21d (patch) | |
tree | cfd2e2baa05c3196f2caacbb63c32e1df40bc3de /library/cpp/testing/common/network.h | |
parent | 7489e4682331202b9c7d863c0898eb83d7b12c2b (diff) | |
download | ydb-6560e4993b14d193f8c879e33a3de5e5eba6e21d.tar.gz |
Restoring authorship annotation for <bulatman@yandex-team.ru>. Commit 1 of 2.
Diffstat (limited to 'library/cpp/testing/common/network.h')
-rw-r--r-- | library/cpp/testing/common/network.h | 100 |
1 files changed, 50 insertions, 50 deletions
diff --git a/library/cpp/testing/common/network.h b/library/cpp/testing/common/network.h index eb4d32f3a1..66fb2b0c40 100644 --- a/library/cpp/testing/common/network.h +++ b/library/cpp/testing/common/network.h @@ -1,52 +1,52 @@ -#pragma once - -#include <util/generic/ptr.h> -#include <util/generic/vector.h> - -namespace NTesting { - - //@brief network port holder interface - class IPort { - public: - virtual ~IPort() {} - - virtual ui16 Get() = 0; - }; - - class TPortHolder : private THolder<IPort> { - using TBase = THolder<IPort>; - public: - using TBase::TBase; - using TBase::Release; - using TBase::Reset; - - operator ui16() const& { - return (*this)->Get(); - } - - operator ui16() const&& = delete; - }; - +#pragma once + +#include <util/generic/ptr.h> +#include <util/generic/vector.h> + +namespace NTesting { + + //@brief network port holder interface + class IPort { + public: + virtual ~IPort() {} + + virtual ui16 Get() = 0; + }; + + class TPortHolder : private THolder<IPort> { + using TBase = THolder<IPort>; + public: + using TBase::TBase; + using TBase::Release; + using TBase::Reset; + + operator ui16() const& { + return (*this)->Get(); + } + + operator ui16() const&& = delete; + }; + IOutputStream& operator<<(IOutputStream& out, const TPortHolder& port); - //@brief Get first free port. - [[nodiscard]] TPortHolder GetFreePort(); - - namespace NLegacy { - // Do not use this method, it needs only for TPortManager from unittests. - // Returns continuous sequence of the specified number of ports. - [[nodiscard]] TVector<TPortHolder> GetFreePortsRange(size_t count); - } - - //@brief helper class for inheritance - struct TFreePortOwner { - TFreePortOwner() : Port_(GetFreePort()) {} - - ui16 GetPort() const { - return Port_; - } - - private: - TPortHolder Port_; - }; -} + //@brief Get first free port. + [[nodiscard]] TPortHolder GetFreePort(); + + namespace NLegacy { + // Do not use this method, it needs only for TPortManager from unittests. + // Returns continuous sequence of the specified number of ports. + [[nodiscard]] TVector<TPortHolder> GetFreePortsRange(size_t count); + } + + //@brief helper class for inheritance + struct TFreePortOwner { + TFreePortOwner() : Port_(GetFreePort()) {} + + ui16 GetPort() const { + return Port_; + } + + private: + TPortHolder Port_; + }; +} |