Class: Babeltrace::CTF::Declaration

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

Instance Attribute Summary collapse

Class Method Summary collapse

Instance Method Summary collapse

Constructor Details

#initialize(declaration) ⇒ Declaration

Returns a new instance of Declaration.



468
469
470
# File 'lib/babeltrace/ctf/events.rb', line 468

def initialize(declaration)
  @declaration = declaration
end

Instance Attribute Details

#declarationObject (readonly)

Returns the value of attribute declaration.



440
441
442
# File 'lib/babeltrace/ctf/events.rb', line 440

def declaration
  @declaration
end

Class Method Details

.create(decl) ⇒ Object



442
443
444
445
446
447
448
449
450
451
452
453
454
455
456
457
458
459
460
461
462
463
464
465
466
# File 'lib/babeltrace/ctf/events.rb', line 442

def self.create(decl)
  return nil if decl.pointer.null?
  case decl.field_type
  when :INTEGER
    IntegerDecl::new(decl)
  when :FLOAT
    FloatDecl::new(decl)
  when :ENUM
    EnumDecl::new(decl)
  when :STRING
    StringDecl::new(decl)
  when :STRUCT
    StructDecl::new(decl)
  when :UNTAGGED_VARIANT
    UntaggedVariantDecl::new(decl)
  when :VARIANT
    VariantDecl::new(decl)
  when :ARRAY
    ArrayDecl::new(decl)
  when :SEQUENCE
    SequenceDecl::new(decl)
  else
    raise "Unknow declaration type #{d.decl.field_type}!"
  end
end

Instance Method Details

#field_typeObject



472
473
474
# File 'lib/babeltrace/ctf/events.rb', line 472

def field_type
  @declaration.field_type
end