class CZMQ::FFI::ZdirPatch

work with directory patches @note This class is 100% generated using zproject.

Constants

CREATE

Creates a new file

DELETE

Delete a file

Public Class Methods

__new(path, file, op, alias_)
Alias for: new
create_finalizer_for(ptr) click to toggle source

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

# File lib/czmq-ffi-gen/czmq/ffi/zdir_patch.rb, line 41
def self.create_finalizer_for(ptr)
  Proc.new do
    ptr_ptr = ::FFI::MemoryPointer.new :pointer
    ptr_ptr.write_pointer ptr
    ::CZMQ::FFI.zdir_patch_destroy ptr_ptr
  end
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/zdir_patch.rb, line 30
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(path, file, op, alias_) click to toggle source

Create new patch @param path [String, to_s, nil] @param file [Zfile, #__ptr] @param op [Integer, to_int, to_i] @param alias_ [String, to_s, nil] @return [CZMQ::ZdirPatch]

# File lib/czmq-ffi-gen/czmq/ffi/zdir_patch.rb, line 88
def self.new(path, file, op, alias_)
  file = file.__ptr if file
  op = Integer(op)
  ptr = ::CZMQ::FFI.zdir_patch_new(path, file, op, alias_)
  __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/zdir_patch.rb, line 182
def self.test(verbose)
  verbose = !(0==verbose||!verbose) # boolean
  result = ::CZMQ::FFI.zdir_patch_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/zdir_patch.rb, line 54
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/zdir_patch.rb, line 65
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/zdir_patch.rb, line 77
def __undef_finalizer
  ObjectSpace.undefine_finalizer self
  @finalizer = nil
end
destroy() click to toggle source

Destroy a patch

@return [void]

# File lib/czmq-ffi-gen/czmq/ffi/zdir_patch.rb, line 98
def destroy()
  return unless @ptr
  self_p = __ptr_give_ref
  result = ::CZMQ::FFI.zdir_patch_destroy(self_p)
  result
end
digest() click to toggle source

Return hash digest for patch file

@return [String]

# File lib/czmq-ffi-gen/czmq/ffi/zdir_patch.rb, line 171
def digest()
  raise DestroyedError unless @ptr
  self_p = @ptr
  result = ::CZMQ::FFI.zdir_patch_digest(self_p)
  result
end
digest_set() click to toggle source

Calculate hash digest for file (create only)

@return [void]

# File lib/czmq-ffi-gen/czmq/ffi/zdir_patch.rb, line 161
def digest_set()
  raise DestroyedError unless @ptr
  self_p = @ptr
  result = ::CZMQ::FFI.zdir_patch_digest_set(self_p)
  result
end
dup() click to toggle source

Create copy of a patch. If the patch is null, or memory was exhausted, returns null.

@return [ZdirPatch]

# File lib/czmq-ffi-gen/czmq/ffi/zdir_patch.rb, line 109
def dup()
  raise DestroyedError unless @ptr
  self_p = @ptr
  result = ::CZMQ::FFI.zdir_patch_dup(self_p)
  result = ZdirPatch.__new result, true
  result
end
file() click to toggle source

Return patch file item

@return [Zfile]

# File lib/czmq-ffi-gen/czmq/ffi/zdir_patch.rb, line 130
def file()
  raise DestroyedError unless @ptr
  self_p = @ptr
  result = ::CZMQ::FFI.zdir_patch_file(self_p)
  result = Zfile.__new result, false
  result
end
null?() click to toggle source

@return [Boolean]

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

Return operation

@return [Integer]

# File lib/czmq-ffi-gen/czmq/ffi/zdir_patch.rb, line 141
def op()
  raise DestroyedError unless @ptr
  self_p = @ptr
  result = ::CZMQ::FFI.zdir_patch_op(self_p)
  result
end
path() click to toggle source

Return patch file directory path

@return [String]

# File lib/czmq-ffi-gen/czmq/ffi/zdir_patch.rb, line 120
def path()
  raise DestroyedError unless @ptr
  self_p = @ptr
  result = ::CZMQ::FFI.zdir_patch_path(self_p)
  result
end
to_ptr()

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

Alias for: __ptr
vpath() click to toggle source

Return patch virtual file path

@return [String]

# File lib/czmq-ffi-gen/czmq/ffi/zdir_patch.rb, line 151
def vpath()
  raise DestroyedError unless @ptr
  self_p = @ptr
  result = ::CZMQ::FFI.zdir_patch_vpath(self_p)
  result
end