Class: Rbind::StdMap
- Inherits:
-
RTemplateClass
- Object
- RBase
- RDataType
- RNamespace
- RClass
- RTemplateClass
- Rbind::StdMap
- Defined in:
- lib/rbind/types/std_map.rb
Instance Attribute Summary
Attributes inherited from RTemplateClass
Attributes included from Logger
Attributes inherited from RClass
Attributes inherited from RNamespace
#consts, #operation_alias, #operations, #root, #type_alias, #used_namespaces
Attributes inherited from RDataType
#cdelete_method, #check_type, #invalid_value, #typedef
Attributes inherited from RBase
#alias, #auto_alias, #cname, #csignature, #doc, #extern_package_name, #ignore, #name, #namespace, #owner, #signature, #version
Instance Method Summary collapse
Methods inherited from RTemplateClass
#add_type, #do_specialize, #initialize, #resolve_type, #specialize_ruby_specialization, #template?
Methods included from Logger
Methods inherited from RClass
#add_attribute, #add_parent, #attribute, #basic_type?, #cdelete_method, #constructor?, #empty?, #initialize, #operation, #operations, #parent_class, #pretty_print, #pretty_print_name, #used_namespaces
Methods inherited from RNamespace
#add_const, #add_default_types, #add_namespace, #add_operation, #add_simple_type, #add_simple_types, #add_type, #add_type_alias, #const, #constructor?, #container?, default_operators, #delete_type, #each_const, #each_container, #each_operation, #each_type, #empty?, #extern?, #initialize, #method_missing, #operation, #operation?, #pretty_print, #pretty_print_name, #root?, #type, #types, #use_namespace
Methods inherited from RDataType
#==, #basic_type?, #check_type?, #cname, #const?, #container?, #initialize, #ownership?, #ptr?, #raw?, #ref?, #remove_const, #remove_ownership, #remove_ptr, #remove_ref, #template?, #to_const, #to_ownership, #to_ptr, #to_raw, #to_ref, #to_single_ptr, #typedef?
Methods inherited from RBase
basename, #binding, #delete!, #doc?, #extern?, #full_name, #generate_signatures, #ignore?, #initialize, #map_to_namespace, namespace, #namespace?, normalize, #pretty_print, #rename, #specialize_ruby, split_name, to_cname, #to_s
Constructor Details
This class inherits a constructor from Rbind::RTemplateClass
Dynamic Method Handling
This class handles dynamic methods through the method_missing method in the class Rbind::RNamespace
Instance Method Details
#specialize(klass, *parameters) ⇒ Object
3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 |
# File 'lib/rbind/types/std_map.rb', line 3 def specialize(klass,*parameters) if parameters.size < 2 raise ArgumentError,"StdMap does require at least two template parameters. Got: #{parameters}}" end map_key_type = parameters.flatten[0] map_value_type = parameters.flatten[1] if parameters.size > 2 map_comp_type = parameters.flatten[2] else map_comp_type = nil end klass.add_operation ROperation.new(klass.name,nil) klass.add_operation ROperation.new(klass.name,nil,RParameter.new("other",klass).to_const) klass.add_operation ROperation.new("size",type("size_t")) klass.add_operation ROperation.new("clear",type("void")) klass.add_operation ROperation.new("capacity",type("size_t")) klass.add_operation ROperation.new("empty",type("bool")) klass.add_operation ROperation.new("operator[]",map_value_type, RParameter.new("key_type", map_key_type)) klass.add_operation ROperation.new("at",map_value_type, RParameter.new("key_type",map_key_type)) klass.add_operation ROperation.new("erase",type("void"), RParameter.new("key_type",map_key_type)) klass end |