farm-ng-core
farm_ng::Shared< TT > Class Template Reference

#include <shared.h>

Public Types

using ExpectedT = farm_ng::Expected< Shared< TT > >
 
using BadExpectedAccess = tl::bad_expected_access< farm_ng::Error >
 

Public Member Functions

TT & operator* ()
 Returns the interior object which is guaranteed to be available. More...
 
TT const & operator* () const
 Returns the interior object which is guaranteed to be available. More...
 
TT * operator-> ()
 Returns the interior object which is guaranteed to be available. More...
 
TT const * operator-> () const
 Returns the interior object which is guaranteed to be available. More...
 
 operator std::shared_ptr< TT > () const
 
std::shared_ptr< TT > sharedPtr () const
 
TT const * ptr () const
 
TT * ptr ()
 
 Shared () requires(std
 
template<DerivedFrom< TT > TDerived>
 Shared (Shared< TDerived > const &other)
 
template<DerivedFrom< TT > TDerived>
 Shared (std::shared_ptr< TDerived > const &panic_if_null)
 
template<DerivedFrom< TT > TDerived>
 Shared (std::unique_ptr< TDerived > &&panic_if_null)
 
 Shared (std::shared_ptr< TT > const &panic_if_null)
 
 Shared (Shared< TT > &&o) noexcept
 
Shared< TT > & operator= (Shared< TT > &&o) noexcept
 
 Shared (Shared< TT > const &)=default
 
Shared< TT > & operator= (Shared< TT > const &)=default
 
bool operator== (Shared< TT > const &rhs) const noexcept
 

Static Public Member Functions

static ExpectedT tryFrom (std::shared_ptr< TT > const &maybe_null) noexcept
 Construct from a possibly null shared_ptr The return value is an object containing either a non-null Shared object pointer,. More...
 
template<class... TArgs>
static ExpectedT tryMake (TArgs &&... args) noexcept
 Construct and also makes interior object T The return value is an object containing either a non-null Shared object pointer, for the new object, or an farm_ng::Error object if memory allocation failst or the constructor for the object throws. More...
 
static Shared from (std::shared_ptr< TT > const &shared)
 Construct from a possibly null shared_ptr Panics if shared is null. See tryFrom() for alternate. More...
 
template<class... TArgs>
static Shared< TT > make (TArgs &&... args)
 Construct and also makes interior object T Panics if the constructor throws. See tryFrom() for alternate. More...
 

Member Typedef Documentation

◆ BadExpectedAccess

template<class TT >
using farm_ng::Shared< TT >::BadExpectedAccess = tl::bad_expected_access<farm_ng::Error>

◆ ExpectedT

template<class TT >
using farm_ng::Shared< TT >::ExpectedT = farm_ng::Expected<Shared<TT> >

Constructor & Destructor Documentation

◆ Shared() [1/7]

template<class TT >
farm_ng::Shared< TT >::Shared ( )
inline

◆ Shared() [2/7]

template<class TT >
template<DerivedFrom< TT > TDerived>
farm_ng::Shared< TT >::Shared ( Shared< TDerived > const &  other)
inline

◆ Shared() [3/7]

template<class TT >
template<DerivedFrom< TT > TDerived>
farm_ng::Shared< TT >::Shared ( std::shared_ptr< TDerived > const &  panic_if_null)
inline

◆ Shared() [4/7]

template<class TT >
template<DerivedFrom< TT > TDerived>
farm_ng::Shared< TT >::Shared ( std::unique_ptr< TDerived > &&  panic_if_null)
inline

◆ Shared() [5/7]

template<class TT >
farm_ng::Shared< TT >::Shared ( std::shared_ptr< TT > const &  panic_if_null)
inline

◆ Shared() [6/7]

template<class TT >
farm_ng::Shared< TT >::Shared ( Shared< TT > &&  o)
inlinenoexcept

◆ Shared() [7/7]

template<class TT >
farm_ng::Shared< TT >::Shared ( Shared< TT > const &  )
default

Member Function Documentation

◆ from()

template<class TT >
static Shared farm_ng::Shared< TT >::from ( std::shared_ptr< TT > const &  shared)
inlinestatic

Construct from a possibly null shared_ptr Panics if shared is null. See tryFrom() for alternate.

◆ make()

template<class TT >
template<class... TArgs>
static Shared<TT> farm_ng::Shared< TT >::make ( TArgs &&...  args)
inlinestatic

Construct and also makes interior object T Panics if the constructor throws. See tryFrom() for alternate.

◆ operator std::shared_ptr< TT >()

template<class TT >
farm_ng::Shared< TT >::operator std::shared_ptr< TT > ( ) const
inline

◆ operator*() [1/2]

template<class TT >
TT& farm_ng::Shared< TT >::operator* ( )
inline

Returns the interior object which is guaranteed to be available.

◆ operator*() [2/2]

template<class TT >
TT const& farm_ng::Shared< TT >::operator* ( ) const
inline

Returns the interior object which is guaranteed to be available.

◆ operator->() [1/2]

template<class TT >
TT* farm_ng::Shared< TT >::operator-> ( )
inline

Returns the interior object which is guaranteed to be available.

◆ operator->() [2/2]

template<class TT >
TT const* farm_ng::Shared< TT >::operator-> ( ) const
inline

Returns the interior object which is guaranteed to be available.

◆ operator=() [1/2]

template<class TT >
Shared<TT>& farm_ng::Shared< TT >::operator= ( Shared< TT > &&  o)
inlinenoexcept

◆ operator=() [2/2]

template<class TT >
Shared<TT>& farm_ng::Shared< TT >::operator= ( Shared< TT > const &  )
default

◆ operator==()

template<class TT >
bool farm_ng::Shared< TT >::operator== ( Shared< TT > const &  rhs) const
inlinenoexcept

◆ ptr() [1/2]

template<class TT >
TT* farm_ng::Shared< TT >::ptr ( )
inline

◆ ptr() [2/2]

template<class TT >
TT const* farm_ng::Shared< TT >::ptr ( ) const
inline

◆ sharedPtr()

template<class TT >
std::shared_ptr<TT> farm_ng::Shared< TT >::sharedPtr ( ) const
inline

◆ tryFrom()

template<class TT >
static ExpectedT farm_ng::Shared< TT >::tryFrom ( std::shared_ptr< TT > const &  maybe_null)
inlinestaticnoexcept

Construct from a possibly null shared_ptr The return value is an object containing either a non-null Shared object pointer,.

◆ tryMake()

template<class TT >
template<class... TArgs>
static ExpectedT farm_ng::Shared< TT >::tryMake ( TArgs &&...  args)
inlinestaticnoexcept

Construct and also makes interior object T The return value is an object containing either a non-null Shared object pointer, for the new object, or an farm_ng::Error object if memory allocation failst or the constructor for the object throws.


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