Rcpp Version 1.0.9
Rcpp::XPtr< T, StoragePolicy, Finalizer, finalizeOnExit > Class Template Reference

#include <XPtr.h>

Inheritance diagram for Rcpp::XPtr< T, StoragePolicy, Finalizer, finalizeOnExit >:
Collaboration diagram for Rcpp::XPtr< T, StoragePolicy, Finalizer, finalizeOnExit >:

Public Types

typedef StoragePolicy< XPtrStorage
 
typedef void(* unspecified_bool_type) ()
 

Public Member Functions

 XPtr (SEXP x)
 
 XPtr (SEXP x, SEXP tag, SEXP prot)
 
 XPtr (T *p, bool set_delete_finalizer=true, SEXP tag=R_NilValue, SEXP prot=R_NilValue)
 
 XPtr (const XPtr &other)
 
XPtroperator= (const XPtr &other)
 
T * get () const
 
 operator unspecified_bool_type () const
 
bool operator! () const
 
T * checked_get () const
 
T & operator* () const
 
T * operator-> () const
 
void setDeleteFinalizer ()
 
void release ()
 
 operator T* ()
 
void update (SEXP)
 
- Public Member Functions inherited from Rcpp::PreserveStorage< XPtr< T, PreserveStorage, standard_delete_finalizer< T >, false > >
 PreserveStorage ()
 
 ~PreserveStorage ()
 
void set__ (SEXP x)
 
SEXP get__ () const
 
SEXP invalidate__ ()
 
T & copy__ (const T &other)
 
bool inherits (const char *clazz) const
 
 operator SEXP () const
 
- Public Member Functions inherited from Rcpp::SlotProxyPolicy< XPtr< T, PreserveStorage, standard_delete_finalizer< T >, false > >
SlotProxy slot (const std::string &name)
 
const_SlotProxy slot (const std::string &name) const
 
bool hasSlot (const std::string &name) const
 
- Public Member Functions inherited from Rcpp::AttributeProxyPolicy< XPtr< T, PreserveStorage, standard_delete_finalizer< T >, false > >
AttributeProxy attr (const std::string &name)
 
const_AttributeProxy attr (const std::string &name) const
 
std::vector< std::string > attributeNames () const
 
bool hasAttribute (const std::string &attr) const
 
- Public Member Functions inherited from Rcpp::TagProxyPolicy< XPtr< T, PreserveStorage, standard_delete_finalizer< T >, false > >
TagProxy tag ()
 
const_TagProxy tag () const
 
- Public Member Functions inherited from Rcpp::ProtectedProxyPolicy< XPtr< T, PreserveStorage, standard_delete_finalizer< T >, false > >
ProtectedProxy prot ()
 
const_ProtectedProxy prot () const
 
- Public Member Functions inherited from Rcpp::RObjectMethods< XPtr< T, PreserveStorage, standard_delete_finalizer< T >, false > >
bool isNULL () const
 
int sexp_type () const
 
bool isObject () const
 
bool isS4 () const
 

Static Public Member Functions

static void unspecified_bool_true ()
 

Private Member Functions

void checked_set (SEXP x)
 

Detailed Description

template<typename T, template< class > class StoragePolicy = PreserveStorage, void Finalizer = standard_delete_finalizer<T>, bool finalizeOnExit = false>
class Rcpp::XPtr< T, StoragePolicy, Finalizer, finalizeOnExit >

Definition at line 61 of file XPtr.h.

Member Typedef Documentation

◆ Storage

template<typename T , template< class > class StoragePolicy = PreserveStorage, void Finalizer = standard_delete_finalizer<T>, bool finalizeOnExit = false>
typedef StoragePolicy<XPtr> Rcpp::XPtr< T, StoragePolicy, Finalizer, finalizeOnExit >::Storage

Definition at line 71 of file XPtr.h.

◆ unspecified_bool_type

template<typename T , template< class > class StoragePolicy = PreserveStorage, void Finalizer = standard_delete_finalizer<T>, bool finalizeOnExit = false>
typedef void(* Rcpp::XPtr< T, StoragePolicy, Finalizer, finalizeOnExit >::unspecified_bool_type) ()

Boolean operator wrapper for get() using the "safe bool idiom", see: http://www.boost.org/doc/libs/1_57_0/boost/smart_ptr/detail/operator_bool.hpp

Definition at line 134 of file XPtr.h.

Constructor & Destructor Documentation

◆ XPtr() [1/4]

template<typename T , template< class > class StoragePolicy = PreserveStorage, void Finalizer = standard_delete_finalizer<T>, bool finalizeOnExit = false>
Rcpp::XPtr< T, StoragePolicy, Finalizer, finalizeOnExit >::XPtr ( SEXP  x)
inlineexplicit

constructs a XPtr wrapping the external pointer (EXTPTRSXP SEXP)

Parameters
xpexternal pointer to wrap

Definition at line 78 of file XPtr.h.

References Rcpp::XPtr< T, StoragePolicy, Finalizer, finalizeOnExit >::checked_set().

Here is the call graph for this function:

◆ XPtr() [2/4]

template<typename T , template< class > class StoragePolicy = PreserveStorage, void Finalizer = standard_delete_finalizer<T>, bool finalizeOnExit = false>
Rcpp::XPtr< T, StoragePolicy, Finalizer, finalizeOnExit >::XPtr ( SEXP  x,
SEXP  tag,
SEXP  prot 
)
inlineexplicit

constructs a XPtr wrapping the external pointer (EXTPTRSXP SEXP)

Parameters
xpexternal pointer to wrap
tagtag to assign to external pointer
protprotected data to assign to external pointer

Definition at line 87 of file XPtr.h.

References Rcpp::XPtr< T, StoragePolicy, Finalizer, finalizeOnExit >::checked_set(), Rcpp::ProtectedProxyPolicy< XPtr< T, PreserveStorage, standard_delete_finalizer< T >, false > >::prot(), and Rcpp::TagProxyPolicy< XPtr< T, PreserveStorage, standard_delete_finalizer< T >, false > >::tag().

Here is the call graph for this function:

◆ XPtr() [3/4]

template<typename T , template< class > class StoragePolicy = PreserveStorage, void Finalizer = standard_delete_finalizer<T>, bool finalizeOnExit = false>
Rcpp::XPtr< T, StoragePolicy, Finalizer, finalizeOnExit >::XPtr ( T *  p,
bool  set_delete_finalizer = true,
SEXP  tag = R_NilValue,
SEXP  prot = R_NilValue 
)
inlineexplicit

creates a new external pointer wrapping the dumb pointer p.

Parameters
pdumb pointer to some object
set_delete_finalizerif set to true, a finalizer will be registered for the external pointer. The finalizer is called when the xp is garbage collected. The finalizer is merely a call to the delete operator or the pointer so you need to make sure the pointer can be "delete" d this way (has to be a C++ object)

Definition at line 104 of file XPtr.h.

References Rcpp::ProtectedProxyPolicy< XPtr< T, PreserveStorage, standard_delete_finalizer< T >, false > >::prot(), RCPP_DEBUG_2, Rcpp::XPtr< T, StoragePolicy, Finalizer, finalizeOnExit >::setDeleteFinalizer(), and Rcpp::TagProxyPolicy< XPtr< T, PreserveStorage, standard_delete_finalizer< T >, false > >::tag().

Here is the call graph for this function:

◆ XPtr() [4/4]

template<typename T , template< class > class StoragePolicy = PreserveStorage, void Finalizer = standard_delete_finalizer<T>, bool finalizeOnExit = false>
Rcpp::XPtr< T, StoragePolicy, Finalizer, finalizeOnExit >::XPtr ( const XPtr< T, StoragePolicy, Finalizer, finalizeOnExit > &  other)
inline

Definition at line 113 of file XPtr.h.

Member Function Documentation

◆ checked_get()

template<typename T , template< class > class StoragePolicy = PreserveStorage, void Finalizer = standard_delete_finalizer<T>, bool finalizeOnExit = false>
T* Rcpp::XPtr< T, StoragePolicy, Finalizer, finalizeOnExit >::checked_get ( ) const
inline

◆ checked_set()

template<typename T , template< class > class StoragePolicy = PreserveStorage, void Finalizer = standard_delete_finalizer<T>, bool finalizeOnExit = false>
void Rcpp::XPtr< T, StoragePolicy, Finalizer, finalizeOnExit >::checked_set ( SEXP  x)
inlineprivate

◆ get()

template<typename T , template< class > class StoragePolicy = PreserveStorage, void Finalizer = standard_delete_finalizer<T>, bool finalizeOnExit = false>
T* Rcpp::XPtr< T, StoragePolicy, Finalizer, finalizeOnExit >::get ( ) const
inline

◆ operator T*()

template<typename T , template< class > class StoragePolicy = PreserveStorage, void Finalizer = standard_delete_finalizer<T>, bool finalizeOnExit = false>
Rcpp::XPtr< T, StoragePolicy, Finalizer, finalizeOnExit >::operator T* ( )
inline

Definition at line 195 of file XPtr.h.

References Rcpp::XPtr< T, StoragePolicy, Finalizer, finalizeOnExit >::checked_get().

Here is the call graph for this function:

◆ operator unspecified_bool_type()

template<typename T , template< class > class StoragePolicy = PreserveStorage, void Finalizer = standard_delete_finalizer<T>, bool finalizeOnExit = false>
Rcpp::XPtr< T, StoragePolicy, Finalizer, finalizeOnExit >::operator unspecified_bool_type ( ) const
inline

◆ operator!()

template<typename T , template< class > class StoragePolicy = PreserveStorage, void Finalizer = standard_delete_finalizer<T>, bool finalizeOnExit = false>
bool Rcpp::XPtr< T, StoragePolicy, Finalizer, finalizeOnExit >::operator! ( ) const
inline

Definition at line 139 of file XPtr.h.

References Rcpp::XPtr< T, StoragePolicy, Finalizer, finalizeOnExit >::get().

Here is the call graph for this function:

◆ operator*()

template<typename T , template< class > class StoragePolicy = PreserveStorage, void Finalizer = standard_delete_finalizer<T>, bool finalizeOnExit = false>
T& Rcpp::XPtr< T, StoragePolicy, Finalizer, finalizeOnExit >::operator* ( ) const
inline

Returns a reference to the object wrapped. This allows this object to look and feel like a dumb pointer to T

Definition at line 157 of file XPtr.h.

References Rcpp::XPtr< T, StoragePolicy, Finalizer, finalizeOnExit >::checked_get().

Here is the call graph for this function:

◆ operator->()

template<typename T , template< class > class StoragePolicy = PreserveStorage, void Finalizer = standard_delete_finalizer<T>, bool finalizeOnExit = false>
T* Rcpp::XPtr< T, StoragePolicy, Finalizer, finalizeOnExit >::operator-> ( ) const
inline

Returns the dumb pointer. This allows to call the -> operator on this as if it was the dumb pointer

Definition at line 165 of file XPtr.h.

References Rcpp::XPtr< T, StoragePolicy, Finalizer, finalizeOnExit >::checked_get().

Here is the call graph for this function:

◆ operator=()

template<typename T , template< class > class StoragePolicy = PreserveStorage, void Finalizer = standard_delete_finalizer<T>, bool finalizeOnExit = false>
XPtr& Rcpp::XPtr< T, StoragePolicy, Finalizer, finalizeOnExit >::operator= ( const XPtr< T, StoragePolicy, Finalizer, finalizeOnExit > &  other)
inline

Definition at line 117 of file XPtr.h.

◆ release()

template<typename T , template< class > class StoragePolicy = PreserveStorage, void Finalizer = standard_delete_finalizer<T>, bool finalizeOnExit = false>
void Rcpp::XPtr< T, StoragePolicy, Finalizer, finalizeOnExit >::release ( )
inline

Release the external pointer (if any) immediately. This will cause the pointer to be deleted and it's storage to be set to NULL. After this call the get() method returns NULL and the checked_get() method throws an exception.

See the discussion here for the basic logic behind release: https://stat.ethz.ch/pipermail/r-help/2007-August/137871.html

Definition at line 183 of file XPtr.h.

References Rcpp::XPtr< T, StoragePolicy, Finalizer, finalizeOnExit >::get().

Here is the call graph for this function:

◆ setDeleteFinalizer()

template<typename T , template< class > class StoragePolicy = PreserveStorage, void Finalizer = standard_delete_finalizer<T>, bool finalizeOnExit = false>
void Rcpp::XPtr< T, StoragePolicy, Finalizer, finalizeOnExit >::setDeleteFinalizer ( )
inline

◆ unspecified_bool_true()

template<typename T , template< class > class StoragePolicy = PreserveStorage, void Finalizer = standard_delete_finalizer<T>, bool finalizeOnExit = false>
static void Rcpp::XPtr< T, StoragePolicy, Finalizer, finalizeOnExit >::unspecified_bool_true ( )
inlinestatic

◆ update()

template<typename T , template< class > class StoragePolicy = PreserveStorage, void Finalizer = standard_delete_finalizer<T>, bool finalizeOnExit = false>
void Rcpp::XPtr< T, StoragePolicy, Finalizer, finalizeOnExit >::update ( SEXP  )
inline

Definition at line 199 of file XPtr.h.


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