Class: CZMQ::FFI::ZhttpServerConnection
- Inherits:
-
Object
- Object
- CZMQ::FFI::ZhttpServerConnection
- Defined in:
- lib/czmq-ffi-gen/czmq/ffi/zhttp_server_connection.rb
Overview
This class is 100% generated using zproject.
Defined Under Namespace
Classes: DestroyedError
Class Method Summary collapse
- .create_finalizer_for(ptr) ⇒ Proc
-
.test(verbose) ⇒ void
Self test of this class.
Instance Method Summary collapse
-
#__ptr ⇒ ::FFI::Pointer
(also: #to_ptr)
Return internal pointer.
-
#__ptr_give_ref ⇒ ::FFI::MemoryPointer
Nullify internal pointer and return pointer pointer.
-
#__undef_finalizer ⇒ void
Undefines the finalizer for this object.
-
#initialize(ptr, finalize = true) ⇒ ZhttpServerConnection
constructor
Attaches the pointer ptr to this instance and defines a finalizer for it if necessary.
- #null? ⇒ Boolean
Constructor Details
#initialize(ptr, finalize = true) ⇒ ZhttpServerConnection
Attaches the pointer ptr to this instance and defines a finalizer for it if necessary.
24 25 26 27 28 29 30 31 32 |
# File 'lib/czmq-ffi-gen/czmq/ffi/zhttp_server_connection.rb', line 24 def initialize(ptr, finalize = true) @ptr = ptr if @ptr.null? @ptr = nil # Remove null pointers so we don't have to test for them. elsif finalize @finalizer = self.class.create_finalizer_for @ptr ObjectSpace.define_finalizer self, @finalizer end end |
Class Method Details
.create_finalizer_for(ptr) ⇒ Proc
34 35 36 37 38 39 40 |
# File 'lib/czmq-ffi-gen/czmq/ffi/zhttp_server_connection.rb', line 34 def self.create_finalizer_for(ptr) Proc.new do "WARNING: "\ "Objects of type #{self} cannot be destroyed implicitly. "\ "Please call the correct destroy method with the relevant arguments." end end |
.test(verbose) ⇒ void
This method returns an undefined value.
Self test of this class.
79 80 81 82 83 |
# File 'lib/czmq-ffi-gen/czmq/ffi/zhttp_server_connection.rb', line 79 def self.test(verbose) verbose = !(0==verbose||!verbose) # boolean result = ::CZMQ::FFI.zhttp_server_connection_test(verbose) result end |
Instance Method Details
#__ptr ⇒ ::FFI::Pointer Also known as: to_ptr
Return internal pointer
47 48 49 50 |
# File 'lib/czmq-ffi-gen/czmq/ffi/zhttp_server_connection.rb', line 47 def __ptr raise DestroyedError unless @ptr @ptr end |
#__ptr_give_ref ⇒ ::FFI::MemoryPointer
This detaches the current instance from the native object and thus makes it unusable.
Nullify internal pointer and return pointer pointer.
58 59 60 61 62 63 64 65 |
# File 'lib/czmq-ffi-gen/czmq/ffi/zhttp_server_connection.rb', line 58 def __ptr_give_ref raise DestroyedError unless @ptr ptr_ptr = ::FFI::MemoryPointer.new :pointer ptr_ptr.write_pointer @ptr __undef_finalizer if @finalizer @ptr = nil ptr_ptr end |
#__undef_finalizer ⇒ void
Only use this if you need to and can guarantee that the native object will be freed by other means.
This method returns an undefined value.
Undefines the finalizer for this object.
70 71 72 73 |
# File 'lib/czmq-ffi-gen/czmq/ffi/zhttp_server_connection.rb', line 70 def __undef_finalizer ObjectSpace.undefine_finalizer self @finalizer = nil end |
#null? ⇒ Boolean
42 43 44 |
# File 'lib/czmq-ffi-gen/czmq/ffi/zhttp_server_connection.rb', line 42 def null? !@ptr or @ptr.null? end |