26 #ifndef SRC_XRDCL_XRDCLCTX_HH_
27 #define SRC_XRDCL_XRDCLCTX_HH_
38 struct Ctx :
protected std::shared_ptr<T*>
43 Ctx() : std::shared_ptr<T*>( std::make_shared<T*>() )
50 Ctx( T *ctx ) : std::shared_ptr<T*>( std::make_shared<T*>( ctx ) )
57 Ctx( T &ctx ) : std::shared_ptr<T*>( std::make_shared<T*>( &ctx ) )
64 Ctx(
const Ctx &ctx ) : std::shared_ptr<T*>( ctx )
71 Ctx(
Ctx &&ctx ) : std::shared_ptr<T*>( std::move( ctx ) )
102 if( !
bool( *this->get() ) )
throw std::logic_error(
"XrdCl::Ctx contains no value!" );
103 return **this->get();
115 if( !
bool( *this->get() ) )
throw std::logic_error(
"XrdCl::Ctx contains no value!" );
Utility class for storing a pointer to operation context.
Ctx(T &ctx)
Constructor (from reference)
Ctx(T *ctx)
Constructor (from pointer)
Ctx & operator=(T *ctx)
Assignment operator (from pointer)
Ctx(const Ctx &ctx)
Copy constructor.
Ctx & operator=(T &ctx)
Assignment operator (from reference)
Ctx()
Default constructor.
Ctx(Ctx &&ctx)
Move constructor.