Class: CZMQ::FFI::ZhttpServerOptions

Inherits:
Object
  • Object
show all
Defined in:
lib/czmq-ffi-gen/czmq/ffi/zhttp_server_options.rb

Overview

Note:

This class is 100% generated using zproject.

zhttp server.

Defined Under Namespace

Classes: DestroyedError

Class Method Summary collapse

Instance Method Summary collapse

Constructor Details

#initialize(ptr, finalize = true) ⇒ ZhttpServerOptions

Attaches the pointer ptr to this instance and defines a finalizer for it if necessary.

Parameters:

  • ptr (::FFI::Pointer)
  • finalize (Boolean) (defaults to: true)


24
25
26
27
28
29
30
31
32
# 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

Class Method Details

.__newObject



18
# File 'lib/czmq-ffi-gen/czmq/ffi/zhttp_server_options.rb', line 18

alias :__new :new

.create_finalizer_for(ptr) ⇒ Proc

Parameters:

  • ptr (::FFI::Pointer)

Returns:

  • (Proc)


35
36
37
38
39
40
41
# 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) ⇒ CZMQ::ZhttpServerOptions

Create options from config tree.

Parameters:

Returns:

  • (CZMQ::ZhttpServerOptions)


86
87
88
89
90
# 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

.newCZMQ::ZhttpServerOptions

Create a new zhttp_server_options.

Returns:

  • (CZMQ::ZhttpServerOptions)


78
79
80
81
# 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

.test(verbose) ⇒ void

This method returns an undefined value.

Self test of this class.

Parameters:

  • verbose (Boolean)


149
150
151
152
153
# 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

Instance Method Details

#__ptr::FFI::Pointer Also known as: to_ptr

Return internal pointer

Returns:

  • (::FFI::Pointer)

Raises:



48
49
50
51
# File 'lib/czmq-ffi-gen/czmq/ffi/zhttp_server_options.rb', line 48

def __ptr
  raise DestroyedError unless @ptr
  @ptr
end

#__ptr_give_ref::FFI::MemoryPointer

Note:

This detaches the current instance from the native object and thus makes it unusable.

Nullify internal pointer and return pointer pointer.

Returns:

  • (::FFI::MemoryPointer)

    the pointer pointing to a pointer pointing to the native object

Raises:



59
60
61
62
63
64
65
66
# 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_finalizervoid

Note:

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.



71
72
73
74
# File 'lib/czmq-ffi-gen/czmq/ffi/zhttp_server_options.rb', line 71

def __undef_finalizer
  ObjectSpace.undefine_finalizer self
  @finalizer = nil
end

#backend_addressString

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

Returns:

  • (String)

Raises:



127
128
129
130
131
132
# 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

#destroyvoid

This method returns an undefined value.

Destroy the zhttp_server_options.



95
96
97
98
99
100
# 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?Boolean

Returns:

  • (Boolean)


43
44
45
# File 'lib/czmq-ffi-gen/czmq/ffi/zhttp_server_options.rb', line 43

def null?
  !@ptr or @ptr.null?
end

#portInteger

Get the server listening port.

Returns:

  • (Integer)

Raises:



105
106
107
108
109
110
# 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) ⇒ void

This method returns an undefined value.

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

Parameters:

  • address (String, #to_s, nil)

Raises:



138
139
140
141
142
143
# 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) ⇒ void

This method returns an undefined value.

Set the server listening port

Parameters:

  • port (Integer, #to_int, #to_i)

Raises:



116
117
118
119
120
121
122
# 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