NVIDIA OptiX 6.5 API nvidia_logo_transpbg.gif Up
 All Classes Files Functions Variables Typedefs Enumerations Enumerator Macros Groups Pages
optix::Handle< T > Class Template Reference

Public Member Functions

 Handle ()
 
 Handle (T *ptr)
 
template<class U >
 Handle (U *ptr)
 
 Handle (const Handle< T > &copy)
 
template<class U >
 Handle (const Handle< U > &copy)
 
Handle< T > & operator= (const Handle< T > &copy)
 
template<class U >
Handle< T > & operator= (const Handle< U > &copy)
 
 ~Handle ()
 
T * operator-> ()
 
const T * operator-> () const
 
T * get ()
 
const T * get () const
 
 operator bool () const
 
Handle< VariableObjoperator[] (const std::string &varname)
 
Handle< VariableObjoperator[] (const char *varname)
 

Static Public Member Functions

static Handle< T > take (typename T::api_t p)
 
static Handle< T > take (RTobject p)
 
static Handle< T > create ()
 
static unsigned int getDeviceCount ()
 

Detailed Description

template<class T>
class optix::Handle< T >

The Handle class is a reference counted handle class used to manipulate API objects.

All interaction with API objects should be done via these handles and the associated typedefs rather than direct usage of the objects.

Member Function Documentation

template<class T >
Handle< VariableObj > optix::Handle< T >::operator[] ( const char *  varname)

Variable access operator. Identical to operator[](const std::string& varname)

Explicitly define char* version to avoid ambiguities between builtin operator[](int, char*) and Handle::operator[]( std::string ). The problem lies in that a Handle can be cast to a bool then to an int which implies that:

Context context;
context["var"];

can be interpreted as either

1["var"]; // Strange but legal way to index into a string (same as "var"[1] )

or

context[ std::string("var") ];