Module: CZMQ::FFI::Wrapper
Overview
Base module for common wrapper logic.
Defined Under Namespace
Modules: ClassMethods
Class Method Summary collapse
Instance Method Summary collapse
-
#__ptr_give_ref ⇒ Object
Give away ownership of the pointer (e.g. for zmsg_send which takes a pointer-to-pointer and nullifies it).
- #null? ⇒ Boolean
- #to_ptr ⇒ Object
Class Method Details
.included(base) ⇒ Object
167 168 169 |
# File 'lib/cztop/ffi.rb', line 167 def self.included(base) base.extend(ClassMethods) end |
Instance Method Details
#__ptr_give_ref ⇒ Object
Give away ownership of the pointer (e.g. for zmsg_send which takes a pointer-to-pointer and nullifies it).
191 192 193 194 195 196 197 198 |
# File 'lib/cztop/ffi.rb', line 191 def __ptr_give_ref raise DestroyedError if @moved ptr_ptr = ::FFI::MemoryPointer.new(:pointer) ptr_ptr.write_pointer(@ptr) @moved = true ObjectSpace.undefine_finalizer(self) ptr_ptr end |
#null? ⇒ Boolean
185 186 187 |
# File 'lib/cztop/ffi.rb', line 185 def null? @ptr.null? || @moved end |
#to_ptr ⇒ Object
180 181 182 183 |
# File 'lib/cztop/ffi.rb', line 180 def to_ptr raise DestroyedError if @moved @ptr end |