Class: IDL::AST::BitMask
- Defined in:
- lib/ridl/node.rb,
lib/ridl/node.rb
Overview
Enumerator
Constant Summary collapse
- DEFINABLE =
[IDL::AST::BitValue]
Instance Attribute Summary collapse
-
#bitbound ⇒ Object
readonly
Returns the value of attribute bitbound.
-
#bitbound_bits ⇒ Object
readonly
Returns the value of attribute bitbound_bits.
-
#idltype ⇒ Object
readonly
Returns the value of attribute idltype.
Attributes inherited from Leaf
#annotations, #enclosure, #intern, #name, #prefix, #scopes
Instance Method Summary collapse
- #add_bitvalue(n) ⇒ Object
- #bitvalues ⇒ Object
- #determine_bitbound ⇒ Object
-
#initialize(name, enclosure, params) ⇒ BitMask
constructor
A new instance of BitMask.
- #instantiate(instantiation_context, _enclosure) ⇒ Object
- #marshal_dump ⇒ Object
- #marshal_load(vars) ⇒ Object
Methods inherited from Node
#define, #introduce, #is_definable?, #match_members, #redefine, #replace_prefix, #resolve, #select_members, #undo_introduction, #walk_members
Methods inherited from Leaf
#has_annotations?, #is_local?, #is_template?, #lm_name, #lm_scopes, #replace_prefix, #repository_id, #resolve, #scoped_lm_name, #scoped_name, #set_repo_id, #set_repo_version, #typename, #unescaped_name
Constructor Details
#initialize(name, enclosure, params) ⇒ BitMask
Returns a new instance of BitMask.
2950 2951 2952 2953 2954 2955 |
# File 'lib/ridl/node.rb', line 2950 def initialize(name, enclosure, params) super(name, enclosure) @bitvalues = [] @idltype = IDL::Type::BitMask.new(self) annotations.concat(params[:annotations]) end |
Instance Attribute Details
#bitbound ⇒ Object (readonly)
Returns the value of attribute bitbound.
2948 2949 2950 |
# File 'lib/ridl/node.rb', line 2948 def bitbound @bitbound end |
#bitbound_bits ⇒ Object (readonly)
Returns the value of attribute bitbound_bits.
2948 2949 2950 |
# File 'lib/ridl/node.rb', line 2948 def bitbound_bits @bitbound_bits end |
#idltype ⇒ Object (readonly)
Returns the value of attribute idltype.
2948 2949 2950 |
# File 'lib/ridl/node.rb', line 2948 def idltype @idltype end |
Instance Method Details
#add_bitvalue(n) ⇒ Object
2973 2974 2975 |
# File 'lib/ridl/node.rb', line 2973 def add_bitvalue(n) @bitvalues << n end |
#bitvalues ⇒ Object
2969 2970 2971 |
# File 'lib/ridl/node.rb', line 2969 def bitvalues @bitvalues end |
#determine_bitbound ⇒ Object
2977 2978 2979 2980 2981 2982 2983 2984 2985 2986 2987 2988 2989 2990 2991 |
# File 'lib/ridl/node.rb', line 2977 def determine_bitbound bitbound = annotations[:bit_bound].first @bitbound_bits = @bitvalues.size unless bitbound.nil? @bitbound_bits = bitbound.fields[:value] raise "Missing number of bits for bit_bound annotation for #{name}" if @bitbound_bits.nil? raise "Illegal negative bit_bound #{bits} value for #{name}" if @bitbound_bits.negative? raise "Illegal zero bit_bound value for #{name}, not #{bits}" if @bitbound_bits.zero? raise "Bitbound for #{name} must be <= 64" unless @bitbound_bits <= 64 end @bitbound = IDL::Type::UTinyShort.new if @bitbound_bits.between?(1,8) @bitbound = IDL::Type::UShort.new if @bitbound_bits.between?(9,16) @bitbound = IDL::Type::ULong.new if @bitbound_bits.between?(17,32) @bitbound = IDL::Type::ULongLong.new if @bitbound_bits.between?(33,64) end |
#instantiate(instantiation_context, _enclosure) ⇒ Object
2993 2994 2995 |
# File 'lib/ridl/node.rb', line 2993 def instantiate(instantiation_context, _enclosure) super(instantiation_context, _enclosure, {}) end |
#marshal_dump ⇒ Object
2957 2958 2959 |
# File 'lib/ridl/node.rb', line 2957 def marshal_dump super() << @idltype << @bitbound << @bitbound_bits << @bitvalues end |
#marshal_load(vars) ⇒ Object
2961 2962 2963 2964 2965 2966 2967 |
# File 'lib/ridl/node.rb', line 2961 def marshal_load(vars) @bitvalues = vars.pop @bitbound_bits = vars.pop @bitbound = vars.pop @idltype = vars.pop super(vars) end |