Class: Zstd::Parameters
- Inherits:
-
Object
- Object
- Zstd::Parameters
- Defined in:
- lib/extzstd.rb,
ext/extzstd.c
Class Method Summary collapse
Instance Method Summary collapse
-
#chainlog ⇒ Object
Get/Set any field from/to struct ZSTD_parameters of C layer.
-
#chainlog= ⇒ Object
Get/Set any field from/to struct ZSTD_parameters of C layer.
-
#hashlog ⇒ Object
Get/Set any field from/to struct ZSTD_parameters of C layer.
-
#hashlog= ⇒ Object
Get/Set any field from/to struct ZSTD_parameters of C layer.
-
#initialize(preset_level = 1, srcsize_hint = 0, dictsize = 0, opts = {}) ⇒ Object
constructor
Initialize struct ZSTD_parameters of C layer.
- #initialize_copy(src) ⇒ Object
- #inspect ⇒ Object
-
#minmatch ⇒ Object
Get/Set any field from/to struct ZSTD_parameters of C layer.
-
#minmatch= ⇒ Object
Get/Set any field from/to struct ZSTD_parameters of C layer.
- #pretty_print(q) ⇒ Object
-
#searchlog ⇒ Object
Get/Set any field from/to struct ZSTD_parameters of C layer.
-
#searchlog= ⇒ Object
Get/Set any field from/to struct ZSTD_parameters of C layer.
-
#strategy ⇒ Object
Get/Set any field from/to struct ZSTD_parameters of C layer.
-
#strategy= ⇒ Object
Get/Set any field from/to struct ZSTD_parameters of C layer.
-
#targetlength ⇒ Object
Get/Set any field from/to struct ZSTD_parameters of C layer.
-
#targetlength= ⇒ Object
Get/Set any field from/to struct ZSTD_parameters of C layer.
-
#windowlog ⇒ Object
Get/Set any field from/to struct ZSTD_parameters of C layer.
-
#windowlog= ⇒ Object
Get/Set any field from/to struct ZSTD_parameters of C layer.
Constructor Details
#initialize(preset_level = 1, srcsize_hint = 0, dictsize = 0, opts = {}) ⇒ Object
Initialize struct ZSTD_parameters of C layer.
- preset_level = 1
- srcsize_hint = 0
- opts windowlog: nil
- opts contentlog: nil
- opts hashlog: nil
- opts searchlog: nil
- opts minmatch: nil
- opts targetlength: nil
- opts strategy: nil
258 259 260 261 262 263 264 265 266 267 268 269 270 271 272 273 274 275 276 277 278 279 280 281 282 283 284 285 286 287 288 289 290 291 292 293 294 295 296 297 |
# File 'ext/extzstd.c', line 258
static VALUE
params_init(int argc, VALUE argv[], VALUE v)
{
ZSTD_parameters *p = getparams(v);
uint64_t sizehint;
size_t dictsize;
int level;
VALUE opts = Qnil;
argc = rb_scan_args(argc, argv, "03:", NULL, NULL, NULL, &opts);
level = argc > 0 ? aux_num2int(argv[0], 0) : 0;
sizehint = argc > 1 ? aux_num2int_u64(argv[1], 0) : 0;
dictsize = argc > 2 ? aux_num2int_u64(argv[2], 0) : 0;
*p = ZSTD_getParams(level, sizehint, dictsize);
if (!NIL_P(opts)) {
#define SETUP_PARAM(var, opts, key, converter) \
do { \
VALUE tmp = rb_hash_lookup(opts, ID2SYM(rb_intern(key))); \
if (!NIL_P(tmp)) { \
var = converter(tmp); \
} \
} while (0) \
SETUP_PARAM(p->cParams.windowLog, opts, "windowlog", NUM2UINT);
SETUP_PARAM(p->cParams.chainLog, opts, "chainlog", NUM2UINT);
SETUP_PARAM(p->cParams.hashLog, opts, "hashlog", NUM2UINT);
SETUP_PARAM(p->cParams.searchLog, opts, "searchlog", NUM2UINT);
SETUP_PARAM(p->cParams.minMatch, opts, "minmatch", NUM2UINT);
SETUP_PARAM(p->cParams.targetLength, opts, "targetlength", NUM2UINT);
SETUP_PARAM(p->cParams.strategy, opts, "strategy", NUM2UINT);
SETUP_PARAM(p->fParams.contentSizeFlag, opts, "contentsize", RTEST);
SETUP_PARAM(p->fParams.checksumFlag, opts, "checksum", RTEST);
SETUP_PARAM(p->fParams.noDictIDFlag, opts, "nodictid", RTEST);
#undef SETUP_PARAM
}
return v;
}
|
Class Method Details
.preset(argv[], mod) ⇒ Object
342 343 344 345 346 347 348 349 350 351 352 353 354 355 356 357 358 359 360 361 362 363 364 365 366 367 368 369 370 371 372 373 374 375 376 377 378 |
# File 'ext/extzstd.c', line 342
static VALUE
params_s_get_preset(int argc, VALUE argv[], VALUE mod)
{
int level;
uint64_t sizehint;
size_t dictsize;
switch (argc) {
case 0:
level = 0;
sizehint = 0;
dictsize = 0;
break;
case 1:
level = NUM2INT(argv[0]);
sizehint = 0;
dictsize = 0;
break;
case 2:
level = NUM2INT(argv[0]);
sizehint = NUM2ULL(argv[1]);
dictsize = 0;
break;
case 3:
level = NUM2INT(argv[0]);
sizehint = NUM2ULL(argv[1]);
dictsize = NUM2SIZET(argv[2]);
break;
default:
rb_error_arity(argc, 0, 3);
}
ZSTD_parameters *p;
VALUE v = TypedData_Make_Struct(mod, ZSTD_parameters, ¶ms_type, p);
*p = ZSTD_getParams(level, sizehint, dictsize);
return v;
}
|
Instance Method Details
#chainlog ⇒ Object
Get/Set any field from/to struct ZSTD_parameters of C layer.
#chainlog= ⇒ Object
Get/Set any field from/to struct ZSTD_parameters of C layer.
#hashlog ⇒ Object
Get/Set any field from/to struct ZSTD_parameters of C layer.
#hashlog= ⇒ Object
Get/Set any field from/to struct ZSTD_parameters of C layer.
#initialize_copy(src) ⇒ Object
299 300 301 302 303 304 305 306 307 308 |
# File 'ext/extzstd.c', line 299
static VALUE
params_init_copy(VALUE params, VALUE src)
{
ZSTD_parameters *a = getparams(params);
ZSTD_parameters *b = getparams(src);
rb_check_frozen(params);
rb_obj_infect(params, src);
memcpy(a, b, sizeof(*a));
return params;
}
|
#inspect ⇒ Object
152 153 154 155 156 |
# File 'lib/extzstd.rb', line 152 def inspect "#<#{self.class} windowlog=#{windowlog}, chainlog=#{chainlog}, " \ "hashlog=#{hashlog}, searchlog=#{searchlog}, " \ "searchlength=#{searchlength}, strategy=#{strategy}>" end |
#minmatch ⇒ Object
Get/Set any field from/to struct ZSTD_parameters of C layer.
#minmatch= ⇒ Object
Get/Set any field from/to struct ZSTD_parameters of C layer.
#pretty_print(q) ⇒ Object
158 159 160 161 162 163 164 165 166 167 168 169 170 171 172 173 174 175 |
# File 'lib/extzstd.rb', line 158 def pretty_print(q) q.group(2, "#<#{self.class}") do q.breakable " " q.text "windowlog=#{windowlog}," q.breakable " " q.text "chainlog=#{chainlog}," q.breakable " " q.text "hashlog=#{hashlog}," q.breakable " " q.text "searchlog=#{searchlog}," q.breakable " " q.text "searchlength=#{searchlength}," q.breakable " " q.text "targetlength=#{targetlength}," q.breakable " " q.text "strategy=#{strategy}>" end end |
#searchlog ⇒ Object
Get/Set any field from/to struct ZSTD_parameters of C layer.
#searchlog= ⇒ Object
Get/Set any field from/to struct ZSTD_parameters of C layer.
#strategy ⇒ Object
Get/Set any field from/to struct ZSTD_parameters of C layer.
#strategy= ⇒ Object
Get/Set any field from/to struct ZSTD_parameters of C layer.
#targetlength ⇒ Object
Get/Set any field from/to struct ZSTD_parameters of C layer.
#targetlength= ⇒ Object
Get/Set any field from/to struct ZSTD_parameters of C layer.
#windowlog ⇒ Object
Get/Set any field from/to struct ZSTD_parameters of C layer.
#windowlog= ⇒ Object
Get/Set any field from/to struct ZSTD_parameters of C layer.