class CZMQ::FFI::ZhttpServerOptions

zhttp server. @note This class is 100% generated using zproject.

Public Class Methods

__new()
Alias for: new
create_finalizer_for(ptr) click to toggle source

@param ptr [::FFI::Pointer] @return [Proc]

# File lib/czmq-ffi-gen/czmq/ffi/zhttp_server_options.rb, line 35
def self.create_finalizer_for(ptr)
  Proc.new do
    ptr_ptr = ::FFI::MemoryPointer.new :pointer
    ptr_ptr.write_pointer ptr
    ::CZMQ::FFI.zhttp_server_options_destroy ptr_ptr
  end
end
from_config(config) click to toggle source

Create options from config tree. @param config [Zconfig, #__ptr] @return [CZMQ::ZhttpServerOptions]

# File lib/czmq-ffi-gen/czmq/ffi/zhttp_server_options.rb, line 86
def self.from_config(config)
  config = config.__ptr if config
  ptr = ::CZMQ::FFI.zhttp_server_options_from_config(config)
  __new ptr
end
new(ptr, finalize = true) click to toggle source

Attaches the pointer ptr to this instance and defines a finalizer for it if necessary. @param ptr [::FFI::Pointer] @param finalize [Boolean]

# File lib/czmq-ffi-gen/czmq/ffi/zhttp_server_options.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
new() click to toggle source

Create a new zhttp_server_options. @return [CZMQ::ZhttpServerOptions]

# File lib/czmq-ffi-gen/czmq/ffi/zhttp_server_options.rb, line 78
def self.new()
  ptr = ::CZMQ::FFI.zhttp_server_options_new()
  __new ptr
end
Also aliased as: __new
test(verbose) click to toggle source

Self test of this class.

@param verbose [Boolean] @return [void]

# File lib/czmq-ffi-gen/czmq/ffi/zhttp_server_options.rb, line 149
def self.test(verbose)
  verbose = !(0==verbose||!verbose) # boolean
  result = ::CZMQ::FFI.zhttp_server_options_test(verbose)
  result
end

Public Instance Methods

__ptr() click to toggle source

Return internal pointer @return [::FFI::Pointer]

# File lib/czmq-ffi-gen/czmq/ffi/zhttp_server_options.rb, line 48
def __ptr
  raise DestroyedError unless @ptr
  @ptr
end
Also aliased as: to_ptr
__ptr_give_ref() click to toggle source

Nullify internal pointer and return pointer pointer. @note This detaches the current instance from the native object

and thus makes it unusable.

@return [::FFI::MemoryPointer] the pointer pointing to a pointer

pointing to the native object
# File lib/czmq-ffi-gen/czmq/ffi/zhttp_server_options.rb, line 59
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() click to toggle source

Undefines the finalizer for this object. @note Only use this if you need to and can guarantee that the native

object will be freed by other means.

@return [void]

# File lib/czmq-ffi-gen/czmq/ffi/zhttp_server_options.rb, line 71
def __undef_finalizer
  ObjectSpace.undefine_finalizer self
  @finalizer = nil
end
backend_address() click to toggle source

Get the address sockets should connect to in order to receive requests.

@return [String]

# File lib/czmq-ffi-gen/czmq/ffi/zhttp_server_options.rb, line 127
def backend_address()
  raise DestroyedError unless @ptr
  self_p = @ptr
  result = ::CZMQ::FFI.zhttp_server_options_backend_address(self_p)
  result
end
destroy() click to toggle source

Destroy the zhttp_server_options.

@return [void]

# File lib/czmq-ffi-gen/czmq/ffi/zhttp_server_options.rb, line 95
def destroy()
  return unless @ptr
  self_p = __ptr_give_ref
  result = ::CZMQ::FFI.zhttp_server_options_destroy(self_p)
  result
end
null?() click to toggle source

@return [Boolean]

# File lib/czmq-ffi-gen/czmq/ffi/zhttp_server_options.rb, line 43
def null?
  !@ptr or @ptr.null?
end
port() click to toggle source

Get the server listening port.

@return [Integer]

# File lib/czmq-ffi-gen/czmq/ffi/zhttp_server_options.rb, line 105
def port()
  raise DestroyedError unless @ptr
  self_p = @ptr
  result = ::CZMQ::FFI.zhttp_server_options_port(self_p)
  result
end
set_backend_address(address) click to toggle source

Set the address sockets should connect to in order to receive requests.

@param address [String, to_s, nil] @return [void]

# File lib/czmq-ffi-gen/czmq/ffi/zhttp_server_options.rb, line 138
def set_backend_address(address)
  raise DestroyedError unless @ptr
  self_p = @ptr
  result = ::CZMQ::FFI.zhttp_server_options_set_backend_address(self_p, address)
  result
end
set_port(port) click to toggle source

Set the server listening port

@param port [Integer, to_int, to_i] @return [void]

# File lib/czmq-ffi-gen/czmq/ffi/zhttp_server_options.rb, line 116
def set_port(port)
  raise DestroyedError unless @ptr
  self_p = @ptr
  port = Integer(port)
  result = ::CZMQ::FFI.zhttp_server_options_set_port(self_p, port)
  result
end
to_ptr()

So external Libraries can just pass the Object to a FFI function which expects a :pointer

Alias for: __ptr