#include <ruby_reference.hpp>
Collaboration diagram for Exc_Ruby::Ruby_Reference< T, Data_Wrapper >:
Public Types | |
typedef void(* | Ruby_Data_Func )(T *obj) |
A function that takes a T* and returns void. | |
Public Member Functions | |
Ruby_Reference (T *obj, VALUE klass, Ruby_Data_Func mark_func=0, Ruby_Data_Func free_func=Ruby_Delete_Strategy< T >::ruby_delete) | |
template<typename U> | Ruby_Reference (Value_Holder value, Ruby_Type< U > const &klass, bool include_super=false) |
Ruby_Reference (Value_Holder value, VALUE klass, bool include_super=false) | |
Ruby_Reference (Value_Holder value) | |
Ruby_Reference (Ruby_Reference const &other) | |
Make a copy of a Ruby_Reference. | |
T & | operator * () const |
Return a reference to obj_. | |
T * | operator-> () const |
Return a pointer to obj_. | |
T * | get () const |
Return a pointer to obj_. | |
VALUE | value () const |
Protected Attributes | |
T * | obj_ |
volatile VALUE | value_ |
Note: do not use these objects on the heap; they are only designed ! for use on the stack (the Ruby GC marks references to objects it ! finds on the stack, but not references objects on the heap).
|
Construct a new Ruby reference, with a type (useful for returning the VALUE to a Ruby function). This is the Exc_Ruby equivalent of Data_Wrap_Struct. |
|
Wrap an already allocated Ruby object, checking for correct C++ type and Ruby type. Will throw a C++ exception if the Ruby type is wrong, and will fail to compile if the C++ type is wrong. This is the Exc_Ruby equivalent of Data_Get_Struct. |
|
Wrap an already allocated Ruby object, checking for correct Ruby type. Will throw a C++ exception if the Ruby type is wrong. |
|
Wrap an already allocated Ruby object. The default data wrapper will check to see if the object is a T_DATA object and throw a C++ exception if this is not the case. Other data wrappers may have different behavior. |
|
Return a ruby refererence < to the held object |
|
Keep the VALUE we wrapped on the stack so the Ruby GC will know we are still using it. |