class CZMQ::FFI::Zuuid

UUID support class @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/zuuid.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.zuuid_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/zuuid.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 UUID object. @return [CZMQ::Zuuid]

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

Create UUID object from supplied ZUUID_LEN-octet value. @param source [::FFI::Pointer, to_ptr] @return [CZMQ::Zuuid]

# File lib/czmq-ffi-gen/czmq/ffi/zuuid.rb, line 86
def self.new_from(source)
  ptr = ::CZMQ::FFI.zuuid_new_from(source)
  __new ptr
end
test(verbose) click to toggle source

Self test of this class.

@param verbose [Boolean] @return [void]

# File lib/czmq-ffi-gen/czmq/ffi/zuuid.rb, line 215
def self.test(verbose)
  verbose = !(0==verbose||!verbose) # boolean
  result = ::CZMQ::FFI.zuuid_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/zuuid.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/zuuid.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/zuuid.rb, line 71
def __undef_finalizer
  ObjectSpace.undefine_finalizer self
  @finalizer = nil
end
data() click to toggle source

Return UUID binary data.

@return [::FFI::Pointer]

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

Destroy a specified UUID object.

@return [void]

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

Make copy of UUID object; if uuid is null, or memory was exhausted, returns null.

@return [Zuuid]

# File lib/czmq-ffi-gen/czmq/ffi/zuuid.rb, line 203
def dup()
  raise DestroyedError unless @ptr
  self_p = @ptr
  result = ::CZMQ::FFI.zuuid_dup(self_p)
  result = Zuuid.__new result, false
  result
end
eq(compare) click to toggle source

Check if UUID is same as supplied value

@param compare [::FFI::Pointer, to_ptr] @return [Boolean]

# File lib/czmq-ffi-gen/czmq/ffi/zuuid.rb, line 181
def eq(compare)
  raise DestroyedError unless @ptr
  self_p = @ptr
  result = ::CZMQ::FFI.zuuid_eq(self_p, compare)
  result
end
export(target) click to toggle source

Store UUID blob in target array

@param target [::FFI::Pointer, to_ptr] @return [void]

# File lib/czmq-ffi-gen/czmq/ffi/zuuid.rb, line 170
def export(target)
  raise DestroyedError unless @ptr
  self_p = @ptr
  result = ::CZMQ::FFI.zuuid_export(self_p, target)
  result
end
neq(compare) click to toggle source

Check if UUID is different from supplied value

@param compare [::FFI::Pointer, to_ptr] @return [Boolean]

# File lib/czmq-ffi-gen/czmq/ffi/zuuid.rb, line 192
def neq(compare)
  raise DestroyedError unless @ptr
  self_p = @ptr
  result = ::CZMQ::FFI.zuuid_neq(self_p, compare)
  result
end
null?() click to toggle source

@return [Boolean]

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

Set UUID to new supplied ZUUID_LEN-octet value.

@param source [::FFI::Pointer, to_ptr] @return [void]

# File lib/czmq-ffi-gen/czmq/ffi/zuuid.rb, line 105
def set(source)
  raise DestroyedError unless @ptr
  self_p = @ptr
  result = ::CZMQ::FFI.zuuid_set(self_p, source)
  result
end
set_str(source) click to toggle source

Set UUID to new supplied string value skipping '-' and '{' '}' optional delimiters. Return 0 if OK, else returns -1.

@param source [String, to_s, nil] @return [Integer]

# File lib/czmq-ffi-gen/czmq/ffi/zuuid.rb, line 117
def set_str(source)
  raise DestroyedError unless @ptr
  self_p = @ptr
  result = ::CZMQ::FFI.zuuid_set_str(self_p, source)
  result
end
size() click to toggle source

Return UUID binary size

@return [Integer]

# File lib/czmq-ffi-gen/czmq/ffi/zuuid.rb, line 137
def size()
  raise DestroyedError unless @ptr
  self_p = @ptr
  result = ::CZMQ::FFI.zuuid_size(self_p)
  result
end
str() click to toggle source

Returns UUID as string

@return [String]

# File lib/czmq-ffi-gen/czmq/ffi/zuuid.rb, line 147
def str()
  raise DestroyedError unless @ptr
  self_p = @ptr
  result = ::CZMQ::FFI.zuuid_str(self_p)
  result
end
str_canonical() click to toggle source

Return UUID in the canonical string format: 8-4-4-4-12, in lower case. Caller does not modify or free returned value. See en.wikipedia.org/wiki/Universally_unique_identifier

@return [String]

# File lib/czmq-ffi-gen/czmq/ffi/zuuid.rb, line 159
def str_canonical()
  raise DestroyedError unless @ptr
  self_p = @ptr
  result = ::CZMQ::FFI.zuuid_str_canonical(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