Class: Fiddle::CUnionEntity
Relationships & Source Files | |
Super Chains via Extension / Inclusion / Inheritance | |
Class Chain:
self,
CStructEntity ,
Pointer ,
FFI::DataConverter
|
|
Instance Chain:
|
|
Inherits: |
Fiddle::CStructEntity
|
Defined in: | ext/fiddle/lib/fiddle/struct.rb |
Overview
A pointer to a C union
Constant Summary
Class Method Summary
-
.size(types)
Returns the size needed for the union with the given
types
.
CStructEntity
- Inherited
.alignment, | |
.malloc | Allocates a C struct with the |
.new | Wraps the C pointer |
.size | Returns the offset for the packed sizes for the given |
Pointer
- Inherited
.[] | call-seq: |
.from_native, .malloc, | |
.new | Create a new pointer to |
.read | Or read the memory at address |
.to_native, | |
.to_ptr | Alias for Pointer.[]. |
.write | Write bytes in |
Instance Attribute Summary
Pointer
- Inherited
#ffi_ptr, | |
#free | Get the free function for this pointer. |
#free= | Set the free function for this pointer to |
#freed? | Returns if the free function for this pointer has been called. |
#null? | Returns |
#size | Get the size of this pointer. |
#size= | Set the size of this pointer to .size |
Instance Method Summary
-
#set_ctypes(types)
Calculate the necessary offset and for each union member with the given
types
CStructEntity
- Inherited
#+, #-, | |
#[] | Fetch struct member |
#[]= | Set struct member |
#assign_names | Set the names of the |
#set_ctypes | Calculates the offsets and sizes for the given |
#to_s |
ValueUtil
- Included
PackInfo
- Included
Pointer
- Inherited
#+ | Returns a new pointer instance that has been advanced |
#+@ | Returns a new |
#- | Returns a new pointer instance that has been moved back |
#-@ | Returns a new |
#<=> | Returns -1 if less than, 0 if equal to, 1 if greater than |
#== | Returns true if |
#[] | Returns integer stored at index. |
#[]= | Set the value at |
#call_free | Call the free function for this pointer. |
#eql? | Alias for Pointer#==. |
#initialize, | |
#inspect | Returns a string formatted with an easily readable representation of the internal state of the pointer. |
#ptr | Alias for Pointer#+@. |
#ref | Alias for Pointer#-@. |
#to_i | Returns the integer memory location of this pointer. |
#to_int | Alias for Pointer#to_i. |
#to_ptr, | |
#to_s | Returns the pointer contents as a string. |
#to_str | Returns the pointer contents as a string. |
#to_value | Cast this pointer to a ruby object. |
Constructor Details
This class inherits a constructor from Fiddle::CStructEntity
Class Method Details
.size(types)
Instance Method Details
#set_ctypes(types)
Calculate the necessary offset and for each union member with the given types
# File 'ext/fiddle/lib/fiddle/struct.rb', line 554
def set_ctypes(types) @ctypes = types @offset = Array.new(types.length, 0) @size = self.class.size types end