Class: Rbind::RVector

Inherits:
RStruct show all
Defined in:
lib/rbind/core/rvector.rb

Instance Attribute Summary

Attributes inherited from RStruct

#attributes

Attributes inherited from RNamespace

#consts, #operation_alias, #operations, #root, #used_namespaces

Attributes inherited from RDataType

#cdelete_method, #check_type, #extern_package_name, #invalid_value, #ptr, #ref, #typedef

Attributes inherited from RBase

#alias, #cname, #csignature, #flags, #ignore, #name, #namespace, #owner, #signature, #version

Instance Method Summary collapse

Methods inherited from RStruct

#add_attribute, #attribute, #basic_type?, #cdelete_method, #constructor?, #pretty_print, #pretty_print_name, #valid_flags

Methods inherited from RNamespace

#add_const, #add_default_types, #add_namespace, #add_operation, #add_simple_type, #add_simple_types, #add_type, #const, #constructor?, #container?, #delete_type, #each_const, #each_container, #each_operation, #each_type, #extern?, #method_missing, #operation, #operation?, #pretty_print, #pretty_print_name, #root?, #type, #types, #use_namespace

Methods inherited from RDataType

#==, #basic_type?, #check_type?, #cname, #container?, #delete!, #extern?, #generate_signatures, #ptr?, #ref?, #to_ptr, #to_value, #typedef?, #valid_flags

Methods inherited from RBase

#add_flag, basename, #binding, #full_name, #generate_signatures, #ignore?, #map_to_namespace, namespace, #namespace?, normalize, #pretty_print, to_cname, #valid_flags, #validate_flags

Constructor Details

#initialize(name, root, type) ⇒ RVector

Returns a new instance of RVector.



3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
# File 'lib/rbind/core/rvector.rb', line 3

def initialize(name,root,type)
    @vector_type = type
    super(name)
    add_operation ROperation.new(self.name,nil)
    add_operation ROperation.new(self.name,nil,RParameter.new("other",self))

    para = Array.new
    para <<  RParameter.new("size",root.type("size_t"))
    para <<  RParameter.new("val",type).default_value(type.full_name)
    add_operation ROperation.new("resize",root.type("void"),para)
    add_operation ROperation.new("size",root.type("size_t"))
    add_operation ROperation.new("capacity",root.type("size_t"))
    add_operation ROperation.new("empty",root.type("bool"))
    add_operation ROperation.new("reserve",root.type("void"),RParameter.new("size",root.type("size_t")))
    add_operation ROperation.new("operator[]",type,RParameter.new("size",root.type("size_t")))
    add_operation ROperation.new("at",type,RParameter.new("size",root.type("size_t")))
    add_operation ROperation.new("front",type)
    add_operation ROperation.new("back",type)
    add_operation ROperation.new("data",root.type("void *"))
    add_operation ROperation.new("push_back",root.type("void"),RParameter.new("other",type))
    add_operation ROperation.new("pop_back",root.type("void"))
    add_operation ROperation.new("swap",root.type("void"),RParameter.new("other",self).add_flag(:IO))
end

Dynamic Method Handling

This class handles dynamic methods through the method_missing method in the class Rbind::RNamespace