aboutsummaryrefslogtreecommitdiffstats
path: root/yt/cpp/mapreduce/interface/tvm.h
blob: d8d16d841b2a6a81d9996ae927503029ae48aaee (plain) (blame)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
#pragma once

#include <yt/yt/library/tvm/tvm_base.h>

#include <library/cpp/yt/memory/intrusive_ptr.h>

namespace NYT::NAuth {

////////////////////////////////////////////////////////////////////////////////

/// This wrapper is required because NYT::NAuth::IServiceTicketAuthPtr is NYT::TIntrusivePtr,
/// and, if we used this pointer in interfaces of `mapreduce/yt` client, a lot of users of this library
/// could get unexpected build errors that `TIntrusivePtr` is ambigious
/// (from `::` namespace and from `::NYT::` namespace).
/// So we use this wrapper in our interfaces to avoid such problems for users.
struct IServiceTicketAuthPtrWrapper
{
    //
    /// Construct wrapper from NYT::TIntrusivePtr
    ///
    /// This constructor is implicit so users can transparently pass NYT::TIntrusivePtr to the functions of
    /// mapreduce/yt client.
    template <class T, class = typename std::enable_if_t<std::is_convertible_v<T*, IServiceTicketAuth*>>>
    IServiceTicketAuthPtrWrapper(const TIntrusivePtr<T> ptr)
        : Ptr(ptr)
    {
    }

    /// Wrapped pointer
    NYT::TIntrusivePtr<IServiceTicketAuth> Ptr;
};

////////////////////////////////////////////////////////////////////////////////

} // namespace NYT::NAuth