tvm.h 1.2 KB

1234567891011121314151617181920212223242526272829303132333435
  1. #pragma once
  2. #include <yt/yt/library/tvm/tvm_base.h>
  3. #include <library/cpp/yt/memory/intrusive_ptr.h>
  4. namespace NYT::NAuth {
  5. ////////////////////////////////////////////////////////////////////////////////
  6. /// This wrapper is required because NYT::NAuth::IServiceTicketAuthPtr is NYT::TIntrusivePtr,
  7. /// and, if we used this pointer in interfaces of `mapreduce/yt` client, a lot of users of this library
  8. /// could get unexpected build errors that `TIntrusivePtr` is ambiguous
  9. /// (from `::` namespace and from `::NYT::` namespace).
  10. /// So we use this wrapper in our interfaces to avoid such problems for users.
  11. struct IServiceTicketAuthPtrWrapper
  12. {
  13. //
  14. /// Construct wrapper from NYT::TIntrusivePtr
  15. ///
  16. /// This constructor is implicit so users can transparently pass NYT::TIntrusivePtr to the functions of
  17. /// mapreduce/yt client.
  18. template <class T, class = typename std::enable_if_t<std::is_convertible_v<T*, IServiceTicketAuth*>>>
  19. IServiceTicketAuthPtrWrapper(const TIntrusivePtr<T> ptr)
  20. : Ptr(ptr)
  21. {
  22. }
  23. /// Wrapped pointer
  24. NYT::TIntrusivePtr<IServiceTicketAuth> Ptr;
  25. };
  26. ////////////////////////////////////////////////////////////////////////////////
  27. } // namespace NYT::NAuth