Class: CZMQ::FFI::Zsock

Inherits:
Object
  • Object
show all
Includes:
Wrapper
Defined in:
lib/cztop/ffi.rb

Overview


Zsock

Constant Summary collapse

DestroyedError =
CZMQ::FFI::DestroyedError

Class Method Summary collapse

Instance Method Summary collapse

Methods included from Wrapper

#__ptr_give_ref, included, #null?, #to_ptr

Constructor Details

#initialize(type) ⇒ Zsock

Returns a new instance of Zsock.



262
263
264
265
266
267
268
269
# File 'lib/cztop/ffi.rb', line 262

def initialize(type)
  @ptr = CZMQ::FFI.zsock_new(type)
  @moved = false
  unless @ptr.null?
    ObjectSpace.define_finalizer(self,
      self.class.prevent_leak(@ptr, :zsock_destroy))
  end
end

Class Method Details

.events(socket) ⇒ Object



360
# File 'lib/cztop/ffi.rb', line 360

def self.events(socket)           = CZMQ::FFI.zsock_events(_resolve_ptr(socket))

.fd(socket) ⇒ Object



359
# File 'lib/cztop/ffi.rb', line 359

def self.fd(socket)               = CZMQ::FFI.zsock_fd(_resolve_ptr(socket))

.heartbeat_ivl(socket) ⇒ Object



354
# File 'lib/cztop/ffi.rb', line 354

def self.heartbeat_ivl(socket)    = CZMQ::FFI.zsock_heartbeat_ivl(_resolve_ptr(socket))

.heartbeat_timeout(socket) ⇒ Object



356
# File 'lib/cztop/ffi.rb', line 356

def self.heartbeat_timeout(socket) = CZMQ::FFI.zsock_heartbeat_timeout(_resolve_ptr(socket))

.heartbeat_ttl(socket) ⇒ Object



355
# File 'lib/cztop/ffi.rb', line 355

def self.heartbeat_ttl(socket)    = CZMQ::FFI.zsock_heartbeat_ttl(_resolve_ptr(socket))

.identity(socket) ⇒ Object



352
# File 'lib/cztop/ffi.rb', line 352

def self.identity(socket)         = CZMQ::FFI.zsock_identity(_resolve_ptr(socket))

.immediate(socket) ⇒ Object



364
# File 'lib/cztop/ffi.rb', line 364

def self.immediate(socket)        = CZMQ::FFI.zsock_immediate(_resolve_ptr(socket))

.ipv6(socket) ⇒ Object



358
# File 'lib/cztop/ffi.rb', line 358

def self.ipv6(socket)             = CZMQ::FFI.zsock_ipv6(_resolve_ptr(socket))

.linger(socket) ⇒ Object



357
# File 'lib/cztop/ffi.rb', line 357

def self.linger(socket)           = CZMQ::FFI.zsock_linger(_resolve_ptr(socket))

.maxmsgsize(socket) ⇒ Object



363
# File 'lib/cztop/ffi.rb', line 363

def self.maxmsgsize(socket)       = CZMQ::FFI.zsock_maxmsgsize(_resolve_ptr(socket))

.new_dealer(endpoint) ⇒ Object



274
# File 'lib/cztop/ffi.rb', line 274

def self.new_dealer(endpoint)  = _wrap(CZMQ::FFI.zsock_new_dealer(endpoint))

.new_pair(endpoint) ⇒ Object



282
# File 'lib/cztop/ffi.rb', line 282

def self.new_pair(endpoint)    = _wrap(CZMQ::FFI.zsock_new_pair(endpoint))

.new_pub(endpoint) ⇒ Object



276
# File 'lib/cztop/ffi.rb', line 276

def self.new_pub(endpoint)     = _wrap(CZMQ::FFI.zsock_new_pub(endpoint))

.new_pull(endpoint) ⇒ Object



281
# File 'lib/cztop/ffi.rb', line 281

def self.new_pull(endpoint)    = _wrap(CZMQ::FFI.zsock_new_pull(endpoint))

.new_push(endpoint) ⇒ Object



280
# File 'lib/cztop/ffi.rb', line 280

def self.new_push(endpoint)    = _wrap(CZMQ::FFI.zsock_new_push(endpoint))

.new_rep(endpoint) ⇒ Object



273
# File 'lib/cztop/ffi.rb', line 273

def self.new_rep(endpoint)     = _wrap(CZMQ::FFI.zsock_new_rep(endpoint))

.new_req(endpoint) ⇒ Object

Factory methods



272
# File 'lib/cztop/ffi.rb', line 272

def self.new_req(endpoint)     = _wrap(CZMQ::FFI.zsock_new_req(endpoint))

.new_router(endpoint) ⇒ Object



275
# File 'lib/cztop/ffi.rb', line 275

def self.new_router(endpoint)  = _wrap(CZMQ::FFI.zsock_new_router(endpoint))

.new_stream(endpoint) ⇒ Object



283
# File 'lib/cztop/ffi.rb', line 283

def self.new_stream(endpoint)  = _wrap(CZMQ::FFI.zsock_new_stream(endpoint))

.new_sub(endpoint, subscribe) ⇒ Object



277
# File 'lib/cztop/ffi.rb', line 277

def self.new_sub(endpoint, subscribe) = _wrap(CZMQ::FFI.zsock_new_sub(endpoint, subscribe))

.new_xpub(endpoint) ⇒ Object



278
# File 'lib/cztop/ffi.rb', line 278

def self.new_xpub(endpoint)    = _wrap(CZMQ::FFI.zsock_new_xpub(endpoint))

.new_xsub(endpoint) ⇒ Object



279
# File 'lib/cztop/ffi.rb', line 279

def self.new_xsub(endpoint)    = _wrap(CZMQ::FFI.zsock_new_xsub(endpoint))

.rcvhwm(socket) ⇒ Object



349
# File 'lib/cztop/ffi.rb', line 349

def self.rcvhwm(socket)           = CZMQ::FFI.zsock_rcvhwm(_resolve_ptr(socket))

.rcvtimeo(socket) ⇒ Object



350
# File 'lib/cztop/ffi.rb', line 350

def self.rcvtimeo(socket)         = CZMQ::FFI.zsock_rcvtimeo(_resolve_ptr(socket))

.reconnect_ivl(socket) ⇒ Object



361
# File 'lib/cztop/ffi.rb', line 361

def self.reconnect_ivl(socket)    = CZMQ::FFI.zsock_reconnect_ivl(_resolve_ptr(socket))

.reconnect_ivl_max(socket) ⇒ Object



362
# File 'lib/cztop/ffi.rb', line 362

def self.reconnect_ivl_max(socket) = CZMQ::FFI.zsock_reconnect_ivl_max(_resolve_ptr(socket))

.set_conflate(socket, val) ⇒ Object



387
# File 'lib/cztop/ffi.rb', line 387

def self.set_conflate(socket, val)            = CZMQ::FFI.zsock_set_conflate(_resolve_ptr(socket), val)

.set_heartbeat_ivl(socket, val) ⇒ Object



378
# File 'lib/cztop/ffi.rb', line 378

def self.set_heartbeat_ivl(socket, val)    = CZMQ::FFI.zsock_set_heartbeat_ivl(_resolve_ptr(socket), val)

.set_heartbeat_timeout(socket, val) ⇒ Object



380
# File 'lib/cztop/ffi.rb', line 380

def self.set_heartbeat_timeout(socket, val) = CZMQ::FFI.zsock_set_heartbeat_timeout(_resolve_ptr(socket), val)

.set_heartbeat_ttl(socket, val) ⇒ Object



379
# File 'lib/cztop/ffi.rb', line 379

def self.set_heartbeat_ttl(socket, val)    = CZMQ::FFI.zsock_set_heartbeat_ttl(_resolve_ptr(socket), val)

.set_identity(socket, val) ⇒ Object



376
# File 'lib/cztop/ffi.rb', line 376

def self.set_identity(socket, val)         = CZMQ::FFI.zsock_set_identity(_resolve_ptr(socket), val)

.set_immediate(socket, val) ⇒ Object



386
# File 'lib/cztop/ffi.rb', line 386

def self.set_immediate(socket, val)        = CZMQ::FFI.zsock_set_immediate(_resolve_ptr(socket), val)

.set_ipv6(socket, val) ⇒ Object



382
# File 'lib/cztop/ffi.rb', line 382

def self.set_ipv6(socket, val)             = CZMQ::FFI.zsock_set_ipv6(_resolve_ptr(socket), val)

.set_linger(socket, val) ⇒ Object



381
# File 'lib/cztop/ffi.rb', line 381

def self.set_linger(socket, val)           = CZMQ::FFI.zsock_set_linger(_resolve_ptr(socket), val)

.set_maxmsgsize(socket, val) ⇒ Object



385
# File 'lib/cztop/ffi.rb', line 385

def self.set_maxmsgsize(socket, val)       = CZMQ::FFI.zsock_set_maxmsgsize(_resolve_ptr(socket), val)

.set_rcvhwm(socket, val) ⇒ Object



372
# File 'lib/cztop/ffi.rb', line 372

def self.set_rcvhwm(socket, val)           = CZMQ::FFI.zsock_set_rcvhwm(_resolve_ptr(socket), val)

.set_rcvtimeo(socket, val) ⇒ Object



373
# File 'lib/cztop/ffi.rb', line 373

def self.set_rcvtimeo(socket, val)         = CZMQ::FFI.zsock_set_rcvtimeo(_resolve_ptr(socket), val)

.set_reconnect_ivl(socket, val) ⇒ Object



383
# File 'lib/cztop/ffi.rb', line 383

def self.set_reconnect_ivl(socket, val)    = CZMQ::FFI.zsock_set_reconnect_ivl(_resolve_ptr(socket), val)

.set_reconnect_ivl_max(socket, val) ⇒ Object



384
# File 'lib/cztop/ffi.rb', line 384

def self.set_reconnect_ivl_max(socket, val) = CZMQ::FFI.zsock_set_reconnect_ivl_max(_resolve_ptr(socket), val)

.set_router_mandatory(socket, val) ⇒ Object



375
# File 'lib/cztop/ffi.rb', line 375

def self.set_router_mandatory(socket, val) = CZMQ::FFI.zsock_set_router_mandatory(_resolve_ptr(socket), val)

.set_sndhwm(socket, val) ⇒ Object

Option setters (class methods taking a socket)



371
# File 'lib/cztop/ffi.rb', line 371

def self.set_sndhwm(socket, val)           = CZMQ::FFI.zsock_set_sndhwm(_resolve_ptr(socket), val)

.set_sndtimeo(socket, val) ⇒ Object



374
# File 'lib/cztop/ffi.rb', line 374

def self.set_sndtimeo(socket, val)         = CZMQ::FFI.zsock_set_sndtimeo(_resolve_ptr(socket), val)

.set_tcp_keepalive(socket, val) ⇒ Object



388
# File 'lib/cztop/ffi.rb', line 388

def self.set_tcp_keepalive(socket, val)       = CZMQ::FFI.zsock_set_tcp_keepalive(_resolve_ptr(socket), val)

.set_tcp_keepalive_cnt(socket, val) ⇒ Object



390
# File 'lib/cztop/ffi.rb', line 390

def self.set_tcp_keepalive_cnt(socket, val)   = CZMQ::FFI.zsock_set_tcp_keepalive_cnt(_resolve_ptr(socket), val)

.set_tcp_keepalive_idle(socket, val) ⇒ Object



389
# File 'lib/cztop/ffi.rb', line 389

def self.set_tcp_keepalive_idle(socket, val)  = CZMQ::FFI.zsock_set_tcp_keepalive_idle(_resolve_ptr(socket), val)

.set_tcp_keepalive_intvl(socket, val) ⇒ Object



391
# File 'lib/cztop/ffi.rb', line 391

def self.set_tcp_keepalive_intvl(socket, val) = CZMQ::FFI.zsock_set_tcp_keepalive_intvl(_resolve_ptr(socket), val)

.set_tos(socket, val) ⇒ Object



377
# File 'lib/cztop/ffi.rb', line 377

def self.set_tos(socket, val)              = CZMQ::FFI.zsock_set_tos(_resolve_ptr(socket), val)

.set_unbounded(socket) ⇒ Object



343
344
345
# File 'lib/cztop/ffi.rb', line 343

def self.set_unbounded(socket)
  CZMQ::FFI.zsock_set_unbounded(_resolve_ptr(socket))
end

.sndhwm(socket) ⇒ Object

Option getters (class methods taking a socket)



348
# File 'lib/cztop/ffi.rb', line 348

def self.sndhwm(socket)           = CZMQ::FFI.zsock_sndhwm(_resolve_ptr(socket))

.sndtimeo(socket) ⇒ Object



351
# File 'lib/cztop/ffi.rb', line 351

def self.sndtimeo(socket)         = CZMQ::FFI.zsock_sndtimeo(_resolve_ptr(socket))

.tcp_keepalive(socket) ⇒ Object



365
# File 'lib/cztop/ffi.rb', line 365

def self.tcp_keepalive(socket)       = CZMQ::FFI.zsock_tcp_keepalive(_resolve_ptr(socket))

.tcp_keepalive_cnt(socket) ⇒ Object



367
# File 'lib/cztop/ffi.rb', line 367

def self.tcp_keepalive_cnt(socket)   = CZMQ::FFI.zsock_tcp_keepalive_cnt(_resolve_ptr(socket))

.tcp_keepalive_idle(socket) ⇒ Object



366
# File 'lib/cztop/ffi.rb', line 366

def self.tcp_keepalive_idle(socket)  = CZMQ::FFI.zsock_tcp_keepalive_idle(_resolve_ptr(socket))

.tcp_keepalive_intvl(socket) ⇒ Object



368
# File 'lib/cztop/ffi.rb', line 368

def self.tcp_keepalive_intvl(socket) = CZMQ::FFI.zsock_tcp_keepalive_intvl(_resolve_ptr(socket))

.tos(socket) ⇒ Object



353
# File 'lib/cztop/ffi.rb', line 353

def self.tos(socket)              = CZMQ::FFI.zsock_tos(_resolve_ptr(socket))

Instance Method Details

#bind(format, *args) ⇒ Object



310
311
312
# File 'lib/cztop/ffi.rb', line 310

def bind(format, *args)
  CZMQ::FFI.zsock_bind(@ptr, format, *args)
end

#connect(format, *args) ⇒ Object



302
303
304
# File 'lib/cztop/ffi.rb', line 302

def connect(format, *args)
  CZMQ::FFI.zsock_connect(@ptr, format, *args)
end

#destroyObject



318
319
320
321
322
323
324
325
# File 'lib/cztop/ffi.rb', line 318

def destroy
  return if @moved
  ptr_ptr = ::FFI::MemoryPointer.new(:pointer)
  ptr_ptr.write_pointer(@ptr)
  CZMQ::FFI.zsock_destroy(ptr_ptr)
  @moved = true
  ObjectSpace.undefine_finalizer(self)
end

#disconnect(format, *args) ⇒ Object



306
307
308
# File 'lib/cztop/ffi.rb', line 306

def disconnect(format, *args)
  CZMQ::FFI.zsock_disconnect(@ptr, format, *args)
end

#endpointObject

Instance methods



298
299
300
# File 'lib/cztop/ffi.rb', line 298

def endpoint
  CZMQ::FFI.zsock_endpoint(@ptr)
end

#set_subscribe(prefix) ⇒ Object



327
328
329
# File 'lib/cztop/ffi.rb', line 327

def set_subscribe(prefix)
  CZMQ::FFI.zsock_set_subscribe(@ptr, prefix)
end

#set_unsubscribe(prefix) ⇒ Object



331
332
333
# File 'lib/cztop/ffi.rb', line 331

def set_unsubscribe(prefix)
  CZMQ::FFI.zsock_set_unsubscribe(@ptr, prefix)
end

#unbind(format, *args) ⇒ Object



314
315
316
# File 'lib/cztop/ffi.rb', line 314

def unbind(format, *args)
  CZMQ::FFI.zsock_unbind(@ptr, format, *args)
end