Class: CZMQ::FFI::ZdirPatch
- Inherits:
-
Object
- Object
- CZMQ::FFI::ZdirPatch
- Defined in:
- lib/czmq-ffi-gen/czmq/ffi/zdir_patch.rb
Overview
This class is 100% generated using zproject.
work with directory patches
Defined Under Namespace
Classes: DestroyedError
Constant Summary collapse
- CREATE =
Creates a new file
1- DELETE =
Delete a file
2
Class Method Summary collapse
- .__new ⇒ Object
- .create_finalizer_for(ptr) ⇒ Proc
-
.new(path, file, op, alias_) ⇒ CZMQ::ZdirPatch
Create new patch.
-
.test(verbose) ⇒ void
Self test of this class.
Instance Method Summary collapse
-
#__ptr ⇒ ::FFI::Pointer
(also: #to_ptr)
Return internal pointer.
-
#__ptr_give_ref ⇒ ::FFI::MemoryPointer
Nullify internal pointer and return pointer pointer.
-
#__undef_finalizer ⇒ void
Undefines the finalizer for this object.
-
#destroy ⇒ void
Destroy a patch.
-
#digest ⇒ String
Return hash digest for patch file.
-
#digest_set ⇒ void
Calculate hash digest for file (create only).
-
#dup ⇒ ZdirPatch
Create copy of a patch.
-
#file ⇒ Zfile
Return patch file item.
-
#initialize(ptr, finalize = true) ⇒ ZdirPatch
constructor
Attaches the pointer ptr to this instance and defines a finalizer for it if necessary.
- #null? ⇒ Boolean
-
#op ⇒ Integer
Return operation.
-
#path ⇒ String
Return patch file directory path.
-
#vpath ⇒ String
Return patch virtual file path.
Constructor Details
#initialize(ptr, finalize = true) ⇒ ZdirPatch
Attaches the pointer ptr to this instance and defines a finalizer for it if necessary.
30 31 32 33 34 35 36 37 38 |
# 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 |
Class Method Details
.__new ⇒ Object
24 |
# File 'lib/czmq-ffi-gen/czmq/ffi/zdir_patch.rb', line 24 alias :__new :new |
.create_finalizer_for(ptr) ⇒ Proc
41 42 43 44 45 46 47 |
# 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(path, file, op, alias_) ⇒ CZMQ::ZdirPatch
Create new patch
88 89 90 91 92 93 |
# 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 |
.test(verbose) ⇒ void
This method returns an undefined value.
Self test of this class.
182 183 184 185 186 |
# 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 |
Instance Method Details
#__ptr ⇒ ::FFI::Pointer Also known as: to_ptr
Return internal pointer
54 55 56 57 |
# File 'lib/czmq-ffi-gen/czmq/ffi/zdir_patch.rb', line 54 def __ptr raise DestroyedError unless @ptr @ptr end |
#__ptr_give_ref ⇒ ::FFI::MemoryPointer
This detaches the current instance from the native object and thus makes it unusable.
Nullify internal pointer and return pointer pointer.
65 66 67 68 69 70 71 72 |
# 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 ⇒ void
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.
77 78 79 80 |
# File 'lib/czmq-ffi-gen/czmq/ffi/zdir_patch.rb', line 77 def __undef_finalizer ObjectSpace.undefine_finalizer self @finalizer = nil end |
#destroy ⇒ void
This method returns an undefined value.
Destroy a patch
98 99 100 101 102 103 |
# 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 ⇒ String
Return hash digest for patch file
171 172 173 174 175 176 |
# 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 ⇒ void
This method returns an undefined value.
Calculate hash digest for file (create only)
161 162 163 164 165 166 |
# 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 ⇒ ZdirPatch
Create copy of a patch. If the patch is null, or memory was exhausted, returns null.
109 110 111 112 113 114 115 |
# 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 ⇒ Zfile
Return patch file item
130 131 132 133 134 135 136 |
# 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? ⇒ Boolean
49 50 51 |
# File 'lib/czmq-ffi-gen/czmq/ffi/zdir_patch.rb', line 49 def null? !@ptr or @ptr.null? end |
#op ⇒ Integer
Return operation
141 142 143 144 145 146 |
# 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 ⇒ String
Return patch file directory path
120 121 122 123 124 125 |
# 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 |
#vpath ⇒ String
Return patch virtual file path
151 152 153 154 155 156 |
# 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 |