XRootD
Loading...
Searching...
No Matches
XrdCl::Fwd< T > Struct Template Reference

#include <XrdClFwd.hh>

+ Inheritance diagram for XrdCl::Fwd< T >:
+ Collaboration diagram for XrdCl::Fwd< T >:

Public Member Functions

 Fwd ()
 
 Fwd (const Fwd &fwd)
 Copy constructor.
 
 Fwd (const T &value)
 Constructor from value.
 
 Fwd (Fwd &&fwd)
 Move constructor.
 
 Fwd (std::shared_ptr< FwdStorage< T > > &&ptr)
 Initialize from shared_ptr.
 
 Fwd (T &&value)
 Move construct from value.
 
T & operator* () const
 
T * operator-> () const
 
Fwdoperator= (const T &value)
 
Fwdoperator= (T &&value)
 
bool Valid () const
 Check if it contains a valid value.
 

Detailed Description

template<typename T>
struct XrdCl::Fwd< T >

A helper class for forwarding arguments between operations. In practice it's a wrapper around std::shared_ptr using FwdStorage as underlying memory.

  • T : type of forwarded value

Definition at line 133 of file XrdClFwd.hh.

Constructor & Destructor Documentation

◆ Fwd() [1/6]

template<typename T>
XrdCl::Fwd< T >::Fwd ( )
inline

Default constructor.

Allocates memory for the underlying value object without callying its constructor.

Definition at line 141 of file XrdClFwd.hh.

Referenced by Fwd(), Fwd(), operator=(), and operator=().

+ Here is the caller graph for this function:

◆ Fwd() [2/6]

template<typename T>
XrdCl::Fwd< T >::Fwd ( const Fwd< T > & fwd)
inline

Copy constructor.

Definition at line 148 of file XrdClFwd.hh.

149 {
150 }

References Fwd().

+ Here is the call graph for this function:

◆ Fwd() [3/6]

template<typename T>
XrdCl::Fwd< T >::Fwd ( Fwd< T > && fwd)
inline

Move constructor.

Definition at line 155 of file XrdClFwd.hh.

156 {
157 }

References Fwd().

+ Here is the call graph for this function:

◆ Fwd() [4/6]

template<typename T>
XrdCl::Fwd< T >::Fwd ( std::shared_ptr< FwdStorage< T > > && ptr)
inline

Initialize from shared_ptr.

Definition at line 162 of file XrdClFwd.hh.

163 {
164 }

◆ Fwd() [5/6]

template<typename T>
XrdCl::Fwd< T >::Fwd ( const T & value)
inlineexplicit

Constructor from value.

Definition at line 169 of file XrdClFwd.hh.

170 {
171 *this->get() = value;
172 }

References XrdCl::NullRef< Response >::value.

◆ Fwd() [6/6]

template<typename T>
XrdCl::Fwd< T >::Fwd ( T && value)
inlineexplicit

Move construct from value.

Definition at line 177 of file XrdClFwd.hh.

178 {
179 *this->get() = std::move( value );
180 }

References XrdCl::NullRef< Response >::value.

Member Function Documentation

◆ operator*()

template<typename T>
T & XrdCl::Fwd< T >::operator* ( ) const
inline

Dereferencing operator. Note if Fwd has not been assigned with a value this will trigger an exception

Returns
: reference to the underlying value
Exceptions
std::logic_error

Definition at line 213 of file XrdClFwd.hh.

214 {
215 if( !bool( this->get()->ptr ) ) throw std::logic_error( "XrdCl::Fwd contains no value!" );
216 return *this->get()->ptr;
217 }

◆ operator->()

template<typename T>
T * XrdCl::Fwd< T >::operator-> ( ) const
inline

Dereferencing member operator. Note if Fwd has not been assigned with a value this will trigger an exception

Returns
: pointer to the underlying value
Exceptions
std::logic_error

Definition at line 226 of file XrdClFwd.hh.

227 {
228 if( !bool( this->get()->ptr ) ) throw std::logic_error( "XrdCl::Fwd contains no value!" );
229 return this->get()->ptr;
230 }

◆ operator=() [1/2]

template<typename T>
Fwd & XrdCl::Fwd< T >::operator= ( const T & value)
inline

Assignment operator.

Parameters
value: forwarded value
Exceptions
std::logic_error

Definition at line 188 of file XrdClFwd.hh.

189 {
190 *this->get() = value;
191 return *this;
192 }

References Fwd(), and XrdCl::NullRef< Response >::value.

+ Here is the call graph for this function:

◆ operator=() [2/2]

template<typename T>
Fwd & XrdCl::Fwd< T >::operator= ( T && value)
inline

Move assignment operator.

Parameters
value: forwarded value
Exceptions
std::logic_error

Definition at line 200 of file XrdClFwd.hh.

201 {
202 *this->get() = std::move( value );
203 return *this;
204 }

References Fwd(), and XrdCl::NullRef< Response >::value.

+ Here is the call graph for this function:

◆ Valid()

template<typename T>
bool XrdCl::Fwd< T >::Valid ( ) const
inline

Check if it contains a valid value.

Definition at line 235 of file XrdClFwd.hh.

236 {
237 return bool( this->get()->ptr );
238 }

The documentation for this struct was generated from the following file: