Rcpp Version 0.12.12
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, SEXP tag=R_NilValue, SEXP prot=R_NilValue)
 
 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::SlotProxyPolicy< XPtr< T, StoragePolicy, Finalizer, finalizeOnExit > >
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, StoragePolicy, Finalizer, finalizeOnExit > >
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, StoragePolicy, Finalizer, finalizeOnExit > >
TagProxy tag ()
 
const_TagProxy tag () const
 
- Public Member Functions inherited from Rcpp::ProtectedProxyPolicy< XPtr< T, StoragePolicy, Finalizer, finalizeOnExit > >
ProtectedProxy prot ()
 
const_ProtectedProxy prot () const
 
- Public Member Functions inherited from Rcpp::RObjectMethods< XPtr< T, StoragePolicy, Finalizer, finalizeOnExit > >
bool isNULL () const
 
int sexp_type () const
 
bool isObject () const
 
bool isS4 () const
 

Static Public Member Functions

static void unspecified_bool_true ()
 

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 49 of file XPtr.h.

Member Typedef Documentation

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 59 of file XPtr.h.

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 117 of file XPtr.h.

Constructor & Destructor Documentation

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 = R_NilValue,
SEXP  prot = R_NilValue 
)
inlineexplicit

constructs a XPtr wrapping the external pointer (EXTPTRSXP SEXP)

Parameters
xpexternal pointer to wrap

Definition at line 66 of file XPtr.h.

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

Here is the call graph for this function:

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 88 of file XPtr.h.

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

Here is the call graph for this function:

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 96 of file XPtr.h.

Member Function Documentation

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
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

Typesafe accessor for underlying pointer (use checked_get if you want an exception thrown if the pointer is NULL)

Definition at line 109 of file XPtr.h.

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 181 of file XPtr.h.

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

Here is the call graph for this function:

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

Definition at line 119 of file XPtr.h.

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

Here is the call graph for this function:

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 123 of file XPtr.h.

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 142 of file XPtr.h.

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

Here is the call graph for this function:

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 150 of file XPtr.h.

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

Here is the call graph for this function:

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 100 of file XPtr.h.

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 167 of file XPtr.h.

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
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
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 185 of file XPtr.h.


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