class HDLRuby::High::Std::TaskT
Describes a high-level task type.
Attributes
name[R]
The name of the task type.
Public Class Methods
new(name,&ruby_block)
click to toggle source
Creates a new task type with name
built whose instances are created from ruby_block
.
# File lib/HDLRuby/std/task.rb, line 16 def initialize(name,&ruby_block) # Checks and sets the name. @name = name.to_sym # Sets the block for instantiating a task. @ruby_block = ruby_block # Sets the instantiation procedure if named. return if @name.empty? obj = self HDLRuby::High.space_reg(@name) do |*args| obj.instantiate(*args) end end
Public Instance Methods
instantiate(*args)
click to toggle source
Intantiates a task
# File lib/HDLRuby/std/task.rb, line 30 def instantiate(*args) obj = self # No argument, so not an instantiation but actually # an access to the task type. return obj if args.empty? # Process the case of generic task. if @ruby_block.arity > 0 then # Actually the arguments are generic arguments, # generates a new task type with these arguments # fixed. ruby_block = @ruby_block return TaskT.new(:"") do HDLRuby::High.top_user.instance_exec(*args,&ruby_block) end end # Generates the tasks. taskI = nil args.each do |nameI| taskI = TaskI.new(name,&@ruby_block) HDLRuby::High.space_reg(nameI) { taskI } end taskI end
Also aliased as: call