OrcaSlicer latest
OrcaSlicer
Loading...
Searching...
No Matches
Slic3r::AnyPtr< T > Class Template Reference

#include </home/runner/work/OrcaSlicer/OrcaSlicer/src/libslic3r/AnyPtr.hpp>

Inheritance diagram for Slic3r::AnyPtr< T >:

Public Member Functions

template<class TT = T, class = std::enable_if_t<std::is_convertible_v<TT, T>>>
 AnyPtr (TT *p=nullptr)
template<class TT, class = std::enable_if_t<std::is_convertible_v<TT, T>>>
 AnyPtr (std::unique_ptr< TT > p)
template<class TT, class = std::enable_if_t<std::is_convertible_v<TT, T>>>
 AnyPtr (std::shared_ptr< TT > p)
template<class TT, class = std::enable_if_t<std::is_convertible_v<TT, T>>>
 AnyPtr (std::weak_ptr< TT > p)
 ~AnyPtr ()=default
 AnyPtr (AnyPtr &&other) noexcept
 AnyPtr (const AnyPtr &other)=delete
AnyPtr & operator= (AnyPtr &&other) noexcept
AnyPtr & operator= (const AnyPtr &other)=delete
template<class TT, class = std::enable_if_t<std::is_convertible_v<TT, T>>>
AnyPtr & operator= (TT *p)
template<class TT, class = std::enable_if_t<std::is_convertible_v<TT, T>>>
AnyPtr & operator= (std::unique_ptr< TT > p)
template<class TT, class = std::enable_if_t<std::is_convertible_v<TT, T>>>
AnyPtr & operator= (std::shared_ptr< TT > p)
template<class TT, class = std::enable_if_t<std::is_convertible_v<TT, T>>>
AnyPtr & operator= (std::weak_ptr< TT > p)
const T & operator* () const
T & operator* ()
T * operator-> ()
const T * operator-> () const
T * get ()
const T * get () const
 operator bool () const
std::shared_ptr< T > get_shared_cpy () const
void convert_unique_to_shared ()
bool is_owned () const noexcept

Private Types

enum  { RawPtr , UPtr , ShPtr , WkPtr }

Static Private Member Functions

template<class Self>
static T * get_ptr (Self &&s)

Private Attributes

boost::variant< T *, std::unique_ptr< T >, std::shared_ptr< T >, std::weak_ptr< T > > ptr

Detailed Description

template<class T>
class Slic3r::AnyPtr< T >

Member Enumeration Documentation

◆ anonymous enum

template<class T>
anonymous enum
private
Enumerator
RawPtr 
UPtr 
ShPtr 
WkPtr 
22{ RawPtr, UPtr, ShPtr, WkPtr };
@ ShPtr
Definition AnyPtr.hpp:22
@ WkPtr
Definition AnyPtr.hpp:22
@ UPtr
Definition AnyPtr.hpp:22
@ RawPtr
Definition AnyPtr.hpp:22

Constructor & Destructor Documentation

◆ AnyPtr() [1/6]

template<class T>
template<class TT = T, class = std::enable_if_t<std::is_convertible_v<TT, T>>>
Slic3r::AnyPtr< T >::AnyPtr ( TT * p = nullptr)
inline
43 : ptr{p}
44 {}
Definition AnyPtr.hpp:21
boost::variant< T *, std::unique_ptr< T >, std::shared_ptr< T >, std::weak_ptr< T > > ptr
Definition AnyPtr.hpp:24

References ptr.

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

Here is the caller graph for this function:

◆ AnyPtr() [2/6]

template<class T>
template<class TT, class = std::enable_if_t<std::is_convertible_v<TT, T>>>
Slic3r::AnyPtr< T >::AnyPtr ( std::unique_ptr< TT > p)
inline

References ptr.

◆ AnyPtr() [3/6]

template<class T>
template<class TT, class = std::enable_if_t<std::is_convertible_v<TT, T>>>
Slic3r::AnyPtr< T >::AnyPtr ( std::shared_ptr< TT > p)
inline

References ptr.

◆ AnyPtr() [4/6]

template<class T>
template<class TT, class = std::enable_if_t<std::is_convertible_v<TT, T>>>
Slic3r::AnyPtr< T >::AnyPtr ( std::weak_ptr< TT > p)
inline

References ptr.

◆ ~AnyPtr()

template<class T>
Slic3r::AnyPtr< T >::~AnyPtr ( )
default

◆ AnyPtr() [5/6]

template<class T>
Slic3r::AnyPtr< T >::AnyPtr ( AnyPtr< T > && other)
inlinenoexcept

References AnyPtr(), and ptr.

Here is the call graph for this function:

◆ AnyPtr() [6/6]

template<class T>
Slic3r::AnyPtr< T >::AnyPtr ( const AnyPtr< T > & other)
delete

References AnyPtr().

Here is the call graph for this function:

Member Function Documentation

◆ convert_unique_to_shared()

template<class T>
void Slic3r::AnyPtr< T >::convert_unique_to_shared ( )
inline
117 {
118 if (ptr.which() == UPtr)
120 }

References ptr, and UPtr.

◆ get() [1/2]

template<class T>
T * Slic3r::AnyPtr< T >::get ( )
inline
81{ return get_ptr(*this); }
static T * get_ptr(Self &&s)
Definition AnyPtr.hpp:26

References get_ptr().

Referenced by get_ptr().

Here is the call graph for this function:
Here is the caller graph for this function:

◆ get() [2/2]

template<class T>
const T * Slic3r::AnyPtr< T >::get ( ) const
inline
82{ return get_ptr(*this); }

References get_ptr().

Here is the call graph for this function:

◆ get_ptr()

template<class T>
template<class Self>
T * Slic3r::AnyPtr< T >::get_ptr ( Self && s)
inlinestaticprivate
27 {
28 switch (s.ptr.which()) {
29 case RawPtr: return boost::get<T *>(s.ptr);
32 case WkPtr: {
34 return shptr.get();
35 }
36 }
37
38 return nullptr;
39 }
T * get()
Definition AnyPtr.hpp:81

References get(), RawPtr, ShPtr, UPtr, and WkPtr.

Referenced by get(), get(), operator*(), operator*(), operator->(), and operator->().

Here is the call graph for this function:
Here is the caller graph for this function:

◆ get_shared_cpy()

template<class T>
std::shared_ptr< T > Slic3r::AnyPtr< T >::get_shared_cpy ( ) const
inline
102 {
104
105 switch (ptr.which()) {
107 case WkPtr: ret = boost::get<std::weak_ptr<T>>(ptr).lock(); break;
108 default:
109 ;
110 }
111
112 return ret;
113 }

References ptr, ShPtr, and WkPtr.

◆ is_owned()

template<class T>
bool Slic3r::AnyPtr< T >::is_owned ( ) const
inlinenoexcept
124 {
125 return ptr.which() == UPtr || ptr.which() == ShPtr;
126 }

References ptr, ShPtr, and UPtr.

◆ operator bool()

template<class T>
Slic3r::AnyPtr< T >::operator bool ( ) const
inline
85 {
86 switch (ptr.which()) {
87 case RawPtr: return bool(boost::get<T *>(ptr));
90 case WkPtr: {
92 return bool(shptr);
93 }
94 }
95
96 return false;
97 }

References ptr, RawPtr, ShPtr, UPtr, and WkPtr.

◆ operator*() [1/2]

template<class T>
T & Slic3r::AnyPtr< T >::operator* ( )
inline
76{ return *get_ptr(*this); }

References get_ptr().

Here is the call graph for this function:

◆ operator*() [2/2]

template<class T>
const T & Slic3r::AnyPtr< T >::operator* ( ) const
inline
75{ return *get_ptr(*this); }

References get_ptr().

Here is the call graph for this function:

◆ operator->() [1/2]

template<class T>
T * Slic3r::AnyPtr< T >::operator-> ( )
inline
78{ return get_ptr(*this); }

References get_ptr().

Here is the call graph for this function:

◆ operator->() [2/2]

template<class T>
const T * Slic3r::AnyPtr< T >::operator-> ( ) const
inline
79{ return get_ptr(*this); }

References get_ptr().

Here is the call graph for this function:

◆ operator=() [1/6]

template<class T>
AnyPtr & Slic3r::AnyPtr< T >::operator= ( AnyPtr< T > && other)
inlinenoexcept
60{ ptr = std::move(other.ptr); return *this; }

References AnyPtr(), and ptr.

Here is the call graph for this function:

◆ operator=() [2/6]

template<class T>
AnyPtr & Slic3r::AnyPtr< T >::operator= ( const AnyPtr< T > & other)
delete

References AnyPtr().

Here is the call graph for this function:

◆ operator=() [3/6]

template<class T>
template<class TT, class = std::enable_if_t<std::is_convertible_v<TT, T>>>
AnyPtr & Slic3r::AnyPtr< T >::operator= ( std::shared_ptr< TT > p)
inline
70{ ptr = p; return *this; }

References AnyPtr(), and ptr.

Here is the call graph for this function:

◆ operator=() [4/6]

template<class T>
template<class TT, class = std::enable_if_t<std::is_convertible_v<TT, T>>>
AnyPtr & Slic3r::AnyPtr< T >::operator= ( std::unique_ptr< TT > p)
inline
67{ ptr = std::move(p); return *this; }

References AnyPtr(), and ptr.

Here is the call graph for this function:

◆ operator=() [5/6]

template<class T>
template<class TT, class = std::enable_if_t<std::is_convertible_v<TT, T>>>
AnyPtr & Slic3r::AnyPtr< T >::operator= ( std::weak_ptr< TT > p)
inline
73{ ptr = std::move(p); return *this; }

References AnyPtr(), and ptr.

Here is the call graph for this function:

◆ operator=() [6/6]

template<class T>
template<class TT, class = std::enable_if_t<std::is_convertible_v<TT, T>>>
AnyPtr & Slic3r::AnyPtr< T >::operator= ( TT * p)
inline
64{ ptr = p; return *this; }

References AnyPtr(), and ptr.

Here is the call graph for this function:

Member Data Documentation

◆ ptr

template<class T>
boost::variant<T*, std::unique_ptr<T>, std::shared_ptr<T>, std::weak_ptr<T> > Slic3r::AnyPtr< T >::ptr
private

The documentation for this class was generated from the following file:
  • /home/runner/work/OrcaSlicer/OrcaSlicer/src/libslic3r/AnyPtr.hpp