mxnet
Public Member Functions | Friends | List of all members
mxnet::runtime::ObjectPtr< T > Class Template Reference

A custom smart pointer for Object. More...

#include <object.h>

Collaboration diagram for mxnet::runtime::ObjectPtr< T >:
Collaboration graph

Public Member Functions

 ObjectPtr ()
 default constructor More...
 
 ObjectPtr (std::nullptr_t)
 default constructor More...
 
 ObjectPtr (const ObjectPtr< T > &other)
 copy constructor More...
 
template<typename U >
 ObjectPtr (const ObjectPtr< U > &other)
 copy constructor More...
 
 ObjectPtr (ObjectPtr< T > &&other)
 move constructor More...
 
template<typename Y >
 ObjectPtr (ObjectPtr< Y > &&other)
 move constructor More...
 
 ~ObjectPtr ()
 destructor More...
 
void swap (ObjectPtr< T > &other)
 Swap this array with another Object. More...
 
T * get () const
 
T * operator-> () const
 
T & operator* () const
 
ObjectPtr< T > & operator= (const ObjectPtr< T > &other)
 copy assignmemt More...
 
ObjectPtr< T > & operator= (ObjectPtr< T > &&other)
 move assignmemt More...
 
void reset ()
 reset the content of ptr to be nullptr More...
 
int use_count () const
 
bool unique () const
 
bool operator== (const ObjectPtr< T > &other) const
 
bool operator!= (const ObjectPtr< T > &other) const
 
bool operator== (std::nullptr_t null) const
 
bool operator!= (std::nullptr_t null) const
 

Friends

class Object
 
class ObjectRef
 
struct ObjectHash
 
template<typename >
class ObjectPtr
 we always used ObjectPtr for a reference pointer to the node, so this alias can be changed in case. More...
 
template<typename >
class ObjAllocatorBase
 
class MXNetPODValue_
 
class MXNetArgsSetter
 
class MXNetRetValue
 
class MXNetArgValue
 
template<typename RefType , typename ObjType >
RefType GetRef (const ObjType *ptr)
 
template<typename BaseType , typename ObjType >
ObjectPtr< BaseType > GetObjectPtr (ObjType *ptr)
 

Detailed Description

template<typename T>
class mxnet::runtime::ObjectPtr< T >

A custom smart pointer for Object.

Template Parameters
Tthe content data type.
See also
make_object

Constructor & Destructor Documentation

◆ ObjectPtr() [1/6]

template<typename T>
mxnet::runtime::ObjectPtr< T >::ObjectPtr ( )
inline

default constructor

◆ ObjectPtr() [2/6]

template<typename T>
mxnet::runtime::ObjectPtr< T >::ObjectPtr ( std::nullptr_t  )
inline

default constructor

◆ ObjectPtr() [3/6]

template<typename T>
mxnet::runtime::ObjectPtr< T >::ObjectPtr ( const ObjectPtr< T > &  other)
inline

copy constructor

Parameters
otherThe value to be moved

◆ ObjectPtr() [4/6]

template<typename T>
template<typename U >
mxnet::runtime::ObjectPtr< T >::ObjectPtr ( const ObjectPtr< U > &  other)
inline

copy constructor

Parameters
otherThe value to be moved

◆ ObjectPtr() [5/6]

template<typename T>
mxnet::runtime::ObjectPtr< T >::ObjectPtr ( ObjectPtr< T > &&  other)
inline

move constructor

Parameters
otherThe value to be moved

◆ ObjectPtr() [6/6]

template<typename T>
template<typename Y >
mxnet::runtime::ObjectPtr< T >::ObjectPtr ( ObjectPtr< Y > &&  other)
inline

move constructor

Parameters
otherThe value to be moved

◆ ~ObjectPtr()

template<typename T>
mxnet::runtime::ObjectPtr< T >::~ObjectPtr ( )
inline

destructor

Member Function Documentation

◆ get()

template<typename T>
T* mxnet::runtime::ObjectPtr< T >::get ( ) const
inline
Returns
Get the content of the pointer

◆ operator!=() [1/2]

template<typename T>
bool mxnet::runtime::ObjectPtr< T >::operator!= ( const ObjectPtr< T > &  other) const
inline
Returns
Whether two ObjectPtr equals each other

◆ operator!=() [2/2]

template<typename T>
bool mxnet::runtime::ObjectPtr< T >::operator!= ( std::nullptr_t  null) const
inline
Returns
Whether the pointer is not nullptr

◆ operator*()

template<typename T>
T& mxnet::runtime::ObjectPtr< T >::operator* ( ) const
inline
Returns
The reference

◆ operator->()

template<typename T>
T* mxnet::runtime::ObjectPtr< T >::operator-> ( ) const
inline
Returns
The pointer

◆ operator=() [1/2]

template<typename T>
ObjectPtr<T>& mxnet::runtime::ObjectPtr< T >::operator= ( const ObjectPtr< T > &  other)
inline

copy assignmemt

Parameters
otherThe value to be assigned.
Returns
reference to self.

◆ operator=() [2/2]

template<typename T>
ObjectPtr<T>& mxnet::runtime::ObjectPtr< T >::operator= ( ObjectPtr< T > &&  other)
inline

move assignmemt

Parameters
otherThe value to be assigned.
Returns
reference to self.

◆ operator==() [1/2]

template<typename T>
bool mxnet::runtime::ObjectPtr< T >::operator== ( const ObjectPtr< T > &  other) const
inline
Returns
Whether two ObjectPtr do not equal each other

◆ operator==() [2/2]

template<typename T>
bool mxnet::runtime::ObjectPtr< T >::operator== ( std::nullptr_t  null) const
inline
Returns
Whether the pointer is nullptr

◆ reset()

template<typename T>
void mxnet::runtime::ObjectPtr< T >::reset ( )
inline

reset the content of ptr to be nullptr

◆ swap()

template<typename T>
void mxnet::runtime::ObjectPtr< T >::swap ( ObjectPtr< T > &  other)
inline

Swap this array with another Object.

Parameters
otherThe other Object

◆ unique()

template<typename T>
bool mxnet::runtime::ObjectPtr< T >::unique ( ) const
inline
Returns
whether the reference is unique

◆ use_count()

template<typename T>
int mxnet::runtime::ObjectPtr< T >::use_count ( ) const
inline
Returns
The use count of the ptr, for debug purposes

Friends And Related Function Documentation

◆ GetObjectPtr

template<typename T>
template<typename BaseType , typename ObjType >
ObjectPtr<BaseType> GetObjectPtr ( ObjType *  ptr)
friend

◆ GetRef

template<typename T>
template<typename RefType , typename ObjType >
RefType GetRef ( const ObjType *  ptr)
friend

◆ MXNetArgsSetter

template<typename T>
friend class MXNetArgsSetter
friend

◆ MXNetArgValue

template<typename T>
friend class MXNetArgValue
friend

◆ MXNetPODValue_

template<typename T>
friend class MXNetPODValue_
friend

◆ MXNetRetValue

template<typename T>
friend class MXNetRetValue
friend

◆ ObjAllocatorBase

template<typename T>
template<typename >
friend class ObjAllocatorBase
friend

◆ Object

template<typename T>
friend class Object
friend

◆ ObjectHash

template<typename T>
friend struct ObjectHash
friend

◆ ObjectPtr

template<typename T>
template<typename >
friend class ObjectPtr
friend

we always used ObjectPtr for a reference pointer to the node, so this alias can be changed in case.

By default, ObjectPtr is a std::shared_ptr of node

◆ ObjectRef

template<typename T>
friend class ObjectRef
friend

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