OptiX  3.9
NVIDIA OptiX Acceleration Engine
 All Classes Files Functions Variables Typedefs Enumerations Enumerator Macros Groups
Public Member Functions | Static Public Member Functions | List of all members
optix::Handle< T > Class Template Reference

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.

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 Handle< T > create (const std::string &a, const std::string &b, const std::string &c)
 
static unsigned int getDeviceCount ()
 

Member Function Documentation

template<class T >
Handle< VariableObj > optix::Handle< T >::operator[] ( const std::string &  varname)

Variable access operator. This operator will query the API object for a variable with the given name, creating a new variable instance if necessary. Only valid for ScopedObjs.

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") ];
template<class T>
static Handle<T> optix::Handle< T >::take ( RTobject  p)
inlinestatic

Special version that takes an RTobject which must be cast up to the appropriate OptiX API opaque type.