Class: LibMsPack::MsPack::MsPackSystem

Inherits:
FFI::Struct
  • Object
show all
Defined in:
lib/libmspack/mspack.rb

Overview

A structure which abstracts file I/O and memory management.

The library always uses the MsPackSystem structure for interaction with the file system and to allocate, free and copy all memory. It also uses it to send literal messages to the library user.

When the library is compiled normally, passing nil to a compressor or decompressor constructor will result in a default MsPackSystem being used, where all methods are implemented with the standard C library. However, all constructors support being given a custom created MsPackSystem structure, with the library user's own methods. This allows for more abstract interaction, such as reading and writing files directly to memory, or from a network socket or pipe.

Implementors of an MsPackSystem structure should read all documentation entries for every structure member, and write methods which conform to those standards.

Instance Method Summary collapse

Instance Method Details

#allocObject



184
185
186
# File 'lib/libmspack/mspack.rb', line 184

def alloc
    self[:alloc]
end

#alloc=(cb) ⇒ Object



180
181
182
# File 'lib/libmspack/mspack.rb', line 180

def alloc=(cb)
    self[:alloc] = cb
end

#closeObject



136
137
138
# File 'lib/libmspack/mspack.rb', line 136

def close
    self[:close]
end

#close=(cb) ⇒ Object



132
133
134
# File 'lib/libmspack/mspack.rb', line 132

def close=(cb)
    self[:close] = cb
end

#copyObject



200
201
202
# File 'lib/libmspack/mspack.rb', line 200

def copy
    self[:copy]
end

#copy=(cb) ⇒ Object



196
197
198
# File 'lib/libmspack/mspack.rb', line 196

def copy=(cb)
    self[:copy] = cb
end

#freeObject



192
193
194
# File 'lib/libmspack/mspack.rb', line 192

def free
    self[:free]
end

#free=(cb) ⇒ Object



188
189
190
# File 'lib/libmspack/mspack.rb', line 188

def free=(cb)
    self[:free] = cb
end

#messageObject



176
177
178
# File 'lib/libmspack/mspack.rb', line 176

def message
    self[:message]
end

#message=(cb) ⇒ Object



172
173
174
# File 'lib/libmspack/mspack.rb', line 172

def message=(cb)
    self[:message] = cb
end

#openObject



128
129
130
# File 'lib/libmspack/mspack.rb', line 128

def open
    self[:open]
end

#open=(cb) ⇒ Object



124
125
126
# File 'lib/libmspack/mspack.rb', line 124

def open=(cb)
    self[:open] = cb
end

#readObject



144
145
146
# File 'lib/libmspack/mspack.rb', line 144

def read
    self[:read]
end

#read=(cb) ⇒ Object



140
141
142
# File 'lib/libmspack/mspack.rb', line 140

def read=(cb)
    self[:read] = cb
end

#seekObject



160
161
162
# File 'lib/libmspack/mspack.rb', line 160

def seek
    self[:seek]
end

#seek=(cb) ⇒ Object



156
157
158
# File 'lib/libmspack/mspack.rb', line 156

def seek=(cb)
    self[:seek] = cb
end

#tellObject



168
169
170
# File 'lib/libmspack/mspack.rb', line 168

def tell
    self[:tell]
end

#tell=(cb) ⇒ Object



164
165
166
# File 'lib/libmspack/mspack.rb', line 164

def tell=(cb)
    self[:tell] = cb
end

#writeObject



152
153
154
# File 'lib/libmspack/mspack.rb', line 152

def write
    self[:write]
end

#write=(cb) ⇒ Object



148
149
150
# File 'lib/libmspack/mspack.rb', line 148

def write=(cb)
    self[:write] = cb
end