Class: GlobalParam

Inherits:
Object
  • Object
show all
Defined in:
lib/tdl/exlib/global_param.rb

Constant Summary collapse

@@sim =
false
@@tdlmodule =
nil
@@tdlmodule_stack =

push when create TdlModule,pop when Tdl.clear

[]
@@sdlmodule_stack =
[]

Class Method Summary collapse

Class Method Details

.CurrSdlModuleObject

def self.CurrTBMode=(a)

@@curr_is_tb_module(a)

end



58
59
60
61
62
63
64
65
66
# File 'lib/tdl/exlib/global_param.rb', line 58

def self.CurrSdlModule
    # @@tdlmodule
    ctm = @@sdlmodule_stack.last
    unless ctm
        @@sdl_etm ||= EmptyModule.new
    else
        ctm
    end
end

.CurrTdlModuleObject



17
18
19
20
21
22
23
24
25
# File 'lib/tdl/exlib/global_param.rb', line 17

def self.CurrTdlModule
    # @@tdlmodule
    ctm = @@tdlmodule_stack.last
    unless ctm
        @@etm ||= EmptyModule.new
    else
        ctm
    end
end

.define_global(name, default_value) ⇒ Object



81
82
83
84
85
86
87
88
89
90
91
# File 'lib/tdl/exlib/global_param.rb', line 81

def self.define_global(name,default_value)
    self.class_variable_set("@@"+name.to_s,default_value)

    self.define_singleton_method(name.to_s) do
        self.class_variable_get("@@"+name.to_s)
    end

    self.define_singleton_method(name.to_s+"=") do |a|
        self.class_variable_set("@@"+name.to_s,a)
    end
end

.PopSdlModuleObject



77
78
79
# File 'lib/tdl/exlib/global_param.rb', line 77

def self.PopSdlModule
    @@sdlmodule_stack.pop
end

.PopTdlModuleObject



47
48
49
# File 'lib/tdl/exlib/global_param.rb', line 47

def self.PopTdlModule
    @@tdlmodule_stack.pop
end

.PushSdlModule(a) ⇒ Object



68
69
70
71
72
73
74
75
# File 'lib/tdl/exlib/global_param.rb', line 68

def self.PushSdlModule(a)
    #bind PackClassVars
    @@sdlmodule_stack << a
    unless self.CurrTBMode
        self.CurrTestTargetModule ||= a  # only first tdlmodule can be Target
    end
    a
end

.PushTdlModule(a) ⇒ Object

def self.RootHierModule

str = NqString.new("$root.")
@@tdlmodule_stack.each do |e|
    str.concat(String.new(e))
end

end



38
39
40
41
42
43
44
45
# File 'lib/tdl/exlib/global_param.rb', line 38

def self.PushTdlModule(a)
    #bind PackClassVars
    @@tdlmodule_stack << a
    unless self.CurrTBMode
        self.CurrTestTargetModule ||= a  # only first tdlmodule can be Target
    end
    a
end

.simObject

@@curr_is_tb_module = nil @@last_module_instance_name = nil



9
10
11
# File 'lib/tdl/exlib/global_param.rb', line 9

def self.sim
    @@sim
end

.sim=(a) ⇒ Object



13
14
15
# File 'lib/tdl/exlib/global_param.rb', line 13

def self.sim=(a)
    @@sim = a
end