STLdoc
STLdocumentation
 All Classes Namespaces Files Functions Variables Typedefs Enumerations Enumerator Friends Macros
Public Types | Public Member Functions | Private Member Functions | Private Attributes | List of all members
msclr::gcroot< T > Struct Template Reference

#include <msclr/gcroot.h>

Public Types

typedef System::Runtime::InteropServices::GCHandle GCHandle
 

Public Member Functions

 gcroot ()
 
 gcroot (T t)
 
 gcroot (const gcroot &r)
 
 ~gcroot ()
 
gcrootoperator= (T t)
 
gcrootoperator= (const gcroot &r)
 
void swap (gcroot< T > &_right)
 
 operator T () const
 
operator-> () const
 

Private Member Functions

T * operator& ()
 

Private Attributes

void_handle
 

Member Typedef Documentation

template<class T>
typedef System::Runtime::InteropServices::GCHandle msclr::gcroot< T >::GCHandle

Constructor & Destructor Documentation

template<class T>
msclr::gcroot< T >::gcroot ( )
inline
65  {
67  }
#define __NULLPTR
Definition: gcroot.h:48
_CRTIMP void *__cdecl Alloc(size_t _NumBytes)
Allocates a block of memory of the size specified from the Concurrency Runtime Caching Suballocator...
void * _handle
Definition: gcroot.h:137
#define __GCHANDLE_TO_VOIDPTR(x)
Definition: gcroot.h:46
template<class T>
msclr::gcroot< T >::gcroot ( t)
inline
72  {
74  }
_CRTIMP void *__cdecl Alloc(size_t _NumBytes)
Allocates a block of memory of the size specified from the Concurrency Runtime Caching Suballocator...
void * _handle
Definition: gcroot.h:137
#define __GCHANDLE_TO_VOIDPTR(x)
Definition: gcroot.h:46
template<class T>
msclr::gcroot< T >::gcroot ( const gcroot< T > &  r)
inline
76  {
77  // don't copy a handle, copy what it points to (see above)
80  __VOIDPTR_TO_GCHANDLE(r._handle).Target ));
81  }
_CRTIMP void *__cdecl Alloc(size_t _NumBytes)
Allocates a block of memory of the size specified from the Concurrency Runtime Caching Suballocator...
#define __VOIDPTR_TO_GCHANDLE(x)
Definition: gcroot.h:47
void * _handle
Definition: gcroot.h:137
#define __GCHANDLE_TO_VOIDPTR(x)
Definition: gcroot.h:46
template<class T>
msclr::gcroot< T >::~gcroot ( )
inline
88  {
90  g.Free();
91  _handle = 0; // should fail if reconstituted
92  }
System::Runtime::InteropServices::GCHandle GCHandle
Definition: gcroot.h:58
#define __VOIDPTR_TO_GCHANDLE(x)
Definition: gcroot.h:47
void * _handle
Definition: gcroot.h:137

Member Function Documentation

template<class T>
msclr::gcroot< T >::operator T ( ) const
inline
117  {
118  // gcroot is typesafe, so use static_cast
119  return static_cast<T>( __VOIDPTR_TO_GCHANDLE(_handle).Target );
120  }
#define __VOIDPTR_TO_GCHANDLE(x)
Definition: gcroot.h:47
void * _handle
Definition: gcroot.h:137
template<class T>
T* msclr::gcroot< T >::operator& ( )
private
template<class T>
T msclr::gcroot< T >::operator-> ( ) const
inline
125  {
126  // gcroot is typesafe, so use static_cast
127  return static_cast<T>(__VOIDPTR_TO_GCHANDLE(_handle).Target);
128  }
#define __VOIDPTR_TO_GCHANDLE(x)
Definition: gcroot.h:47
void * _handle
Definition: gcroot.h:137
template<class T>
gcroot& msclr::gcroot< T >::operator= ( t)
inline
96  {
97  // no need to check for valid handle; was allocated in ctor
98  __VOIDPTR_TO_GCHANDLE(_handle).Target = t;
99  return *this;
100  }
#define __VOIDPTR_TO_GCHANDLE(x)
Definition: gcroot.h:47
void * _handle
Definition: gcroot.h:137
template<class T>
gcroot& msclr::gcroot< T >::operator= ( const gcroot< T > &  r)
inline
102  {
103  // no need to check for valid handle; was allocated in ctor
104  T t = (T)r;
105  __VOIDPTR_TO_GCHANDLE(_handle).Target = t;
106  return *this;
107  }
#define __VOIDPTR_TO_GCHANDLE(x)
Definition: gcroot.h:47
void * _handle
Definition: gcroot.h:137
template<class T>
void msclr::gcroot< T >::swap ( gcroot< T > &  _right)
inline
110  {
111  using std::swap;
112  swap( _handle, _right._handle );
113  }
void swap(gcroot< T > &_left, gcroot< T > &_right)
Definition: gcroot.h:142
void * _handle
Definition: gcroot.h:137
void swap(gcroot< T > &_right)
Definition: gcroot.h:109

Member Data Documentation

template<class T>
void* msclr::gcroot< T >::_handle
private

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