mxnet
|
Base class of all object reference. More...
#include <object.h>
Public Types | |
using | ContainerType = Object |
type indicate the container type. More... | |
Public Member Functions | |
ObjectRef ()=default | |
default constructor More... | |
ObjectRef (ObjectPtr< Object > data) | |
Constructor from existing object ptr. More... | |
bool | same_as (const ObjectRef &other) const |
Comparator. More... | |
bool | operator== (const ObjectRef &other) const |
Comparator. More... | |
bool | operator!= (const ObjectRef &other) const |
Comparator. More... | |
bool | operator< (const ObjectRef &other) const |
Comparator. More... | |
bool | defined () const |
const Object * | get () const |
const Object * | operator-> () const |
bool | unique () const |
template<typename ObjectType > | |
const ObjectType * | as () const |
Try to downcast the internal Object to a raw pointer of a corresponding type. More... | |
Protected Member Functions | |
Object * | get_mutable () const |
Static Protected Member Functions | |
template<typename T > | |
static T | DowncastNoCheck (ObjectRef ref) |
Internal helper function downcast a ref without check. More... | |
template<typename ObjectType > | |
static ObjectPtr< ObjectType > | GetDataPtr (const ObjectRef &ref) |
Internal helper function get data_ as ObjectPtr of ObjectType. More... | |
Protected Attributes | |
ObjectPtr< Object > | data_ |
Internal pointer that backs the reference. More... | |
Friends | |
struct | ObjectHash |
class | MXNetRetValue |
class | MXNetArgsSetter |
template<typename SubRef , typename BaseRef > | |
SubRef | Downcast (BaseRef ref) |
Downcast a base reference type to a more specific type. More... | |
Base class of all object reference.
type indicate the container type.
|
default |
default constructor
Constructor from existing object ptr.
|
inline |
Try to downcast the internal Object to a raw pointer of a corresponding type.
The function will return a nullptr if the cast failed.
if (const Add *add = node_ref.As<Add>()) { // This is an add node }
ObjectType | the target type, must be a subtype of Object/ |
|
inline |
|
inlinestaticprotected |
Internal helper function downcast a ref without check.
T | The target reference type. |
|
inline |
|
inlineprotected |
|
inlinestaticprotected |
Internal helper function get data_ as ObjectPtr of ObjectType.
ObjectType | The corresponding object type. |
|
inline |
Comparator.
other | Another object ref. |
|
inline |
|
inline |
Comparator.
other | Another object ref by address. |
|
inline |
Comparator.
other | Another object ref. |
|
inline |
Comparator.
other | Another object ref. |
|
inline |
|
friend |
Downcast a base reference type to a more specific type.
ref | The inptut reference |
SubRef | The target specific reference type. |
BaseRef | the current reference type. |
|
friend |
|
friend |
|
friend |
Internal pointer that backs the reference.