Class: Babeltrace::CTF::SequenceDecl

Inherits:
Declaration show all
Defined in:
lib/babeltrace/ctf/events.rb,
ext/babeltrace_c/babeltrace.c

Overview

< Declaration

Instance Attribute Summary

Attributes inherited from Declaration

#declaration

Instance Method Summary collapse

Methods inherited from Declaration

create, #field_type, #initialize

Constructor Details

This class inherits a constructor from Babeltrace::CTF::Declaration

Instance Method Details

#def_classObject



557
558
559
560
561
562
563
564
565
# File 'lib/babeltrace/ctf/events.rb', line 557

def def_class
  e = elem
  if e.kind_of?(IntegerDecl) && e.len == 8 &&
      ( e.encoding == :ASCII || e.encoding == :UTF8 )
    SequenceTextDef
  else
    SequenceDef
  end
end

#elemObject



38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
# File 'ext/babeltrace_c/babeltrace.c', line 38

static VALUE babeltrace_ctf_sequence_decl_elem(VALUE self) {

  VALUE decl = rb_ivar_get(self, rb_intern("@declaration"));
  VALUE p = rb_funcall(decl, rb_intern("pointer"), 0);
  VALUE address = rb_funcall(p, rb_intern("address"), 0);

  const struct declaration_sequence *ptr = sizeof(ptr) == 4 ? (const struct declaration_sequence *) NUM2ULONG(address) : (const struct declaration_sequence *) NUM2ULL(address);
  struct bt_declaration *elem = ptr->elem;

  VALUE ffi_ptr = rb_funcall(c_ffi_pointer, rb_intern("new"), 1, ULL2NUM( sizeof(ptr) == 4 ? (unsigned long long int) (unsigned long int) elem : (unsigned long long int) elem ));

  VALUE idecl = rb_funcall(c_internal_declaration, rb_intern("new"), 1, ffi_ptr);
  VALUE seq_decl = rb_funcall(c_ctf_sequence_declaration, rb_intern("create"), 1, idecl);
  return seq_decl;
}