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.



457
458
459
# File 'lib/babeltrace/ctf/events.rb', line 457

def initialize(declaration)
  @declaration = declaration
end

Instance Attribute Details

#declarationObject (readonly)

Returns the value of attribute declaration.



429
430
431
# File 'lib/babeltrace/ctf/events.rb', line 429

def declaration
  @declaration
end

Class Method Details

.create(decl) ⇒ Object



431
432
433
434
435
436
437
438
439
440
441
442
443
444
445
446
447
448
449
450
451
452
453
454
455
# File 'lib/babeltrace/ctf/events.rb', line 431

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



461
462
463
# File 'lib/babeltrace/ctf/events.rb', line 461

def field_type
  @declaration.field_type
end