Class: OpenCV::VectorUchar

Inherits:
Object
  • Object
show all
Extended by:
FFI::DataConverter
Includes:
Enumerable
Defined in:
lib/ruby/ropencv/ropencv_types.rb

Instance Attribute Summary collapse

Class Method Summary collapse

Instance Method Summary collapse

Constructor Details

#initialize(ptr) ⇒ VectorUchar

This method is part of a private API. You should avoid using this method if possible, as it may be removed or be changed in the future.

Returns a new instance of VectorUchar.



22014
22015
22016
22017
22018
22019
22020
# File 'lib/ruby/ropencv/ropencv_types.rb', line 22014

def initialize(ptr)
    @__obj_ptr__ = if ptr.is_a? VectorUcharStruct
                       ptr
                   else
                       VectorUcharStruct.new(FFI::AutoPointer.new(ptr,VectorUcharStruct.method(:release)))
                   end
end

Instance Attribute Details

#__obj_ptr__Object (readonly)

This method is part of a private API. You should avoid using this method if possible, as it may be removed or be changed in the future.



22011
22012
22013
# File 'lib/ruby/ropencv/ropencv_types.rb', line 22011

def __obj_ptr__
  @__obj_ptr__
end

Class Method Details

.from_native(ptr, context) ⇒ Object

This method is part of a private API. You should avoid using this method if possible, as it may be removed or be changed in the future.

can be overwritten by the user



22006
22007
22008
# File 'lib/ruby/ropencv/ropencv_types.rb', line 22006

def self.from_native(ptr,context)
    rbind_from_native(ptr,context)
end

.new(*args) ⇒ Object

Raises:

  • (ArgumentError)


21950
21951
21952
21953
21954
21955
21956
21957
21958
21959
21960
21961
21962
21963
21964
21965
21966
21967
21968
21969
21970
21971
21972
21973
21974
21975
21976
21977
21978
21979
21980
21981
21982
# File 'lib/ruby/ropencv/ropencv_types.rb', line 21950

def self.new(*args)
    if args.first.is_a?(FFI::Pointer) || args.first.is_a?(VectorUcharStruct)
        raise ArgumentError, "too many arguments for creating #{self.name} from Pointer" unless args.size == 1
        return super(args.first)
    end
    # wrapper for vector_uchar::vector_uchar()
    @@vector_uchar_vector_uchar_defaults0 ||= []
    if(args.size >= 0 && args.size <= 0)
        args.size.upto(-1) do |i|
            args[i] = @@vector_uchar_vector_uchar_defaults0[i]
        end
        begin
            return Rbind::vector_uchar_vector_uchar(*args)
        rescue TypeError => e
            @error = e
        end
    end

    # wrapper for vector_uchar::vector_uchar(const vector_uchar other)
    @@vector_uchar_vector_uchar2_defaults1 ||= [nil]
    if(args.size >= 1 && args.size <= 1)
        args.size.upto(0) do |i|
            args[i] = @@vector_uchar_vector_uchar2_defaults1[i]
        end
        begin
            return Rbind::vector_uchar_vector_uchar2(*args)
        rescue TypeError => e
            @error = e
        end
    end

    raise ArgumentError, "no constructor for #{self}(#{args.inspect})"
end

.rbind_from_native(ptr, context) ⇒ Object

This method is part of a private API. You should avoid using this method if possible, as it may be removed or be changed in the future.



21994
21995
21996
# File 'lib/ruby/ropencv/ropencv_types.rb', line 21994

def self.rbind_from_native(ptr,context)
    VectorUchar.new(ptr)
end

.rbind_to_native(obj, context) ⇒ Object

This method is part of a private API. You should avoid using this method if possible, as it may be removed or be changed in the future.



21985
21986
21987
21988
21989
21990
21991
# File 'lib/ruby/ropencv/ropencv_types.rb', line 21985

def self.rbind_to_native(obj,context)
    if obj.is_a? VectorUchar
        obj.__obj_ptr__
    else
        raise TypeError, "expected kind of #{name}, was #{obj.class}"
    end
end

.to_native(obj, context) ⇒ Object

This method is part of a private API. You should avoid using this method if possible, as it may be removed or be changed in the future.

can be overwritten by the user



22000
22001
22002
# File 'lib/ruby/ropencv/ropencv_types.rb', line 22000

def self.to_native(obj,context)
    rbind_to_native(obj,context)
end

Instance Method Details

#<<(val) ⇒ Object



22041
22042
22043
# File 'lib/ruby/ropencv/ropencv_types.rb', line 22041

def <<(val)
    push_back(val)
end

#[](size) ⇒ Object

wrapper for uchar vector_uchar::operator[](size_t size)



22086
22087
22088
# File 'lib/ruby/ropencv/ropencv_types.rb', line 22086

def [](size)
    Rbind::vector_uchar_operator_array( self, size)
end

#__owner__?Boolean

This method is part of a private API. You should avoid using this method if possible, as it may be removed or be changed in the future.

returns true if the underlying pointer is owner of the real object

Returns:

  • (Boolean)


22025
22026
22027
# File 'lib/ruby/ropencv/ropencv_types.rb', line 22025

def __owner__?
    @__obj_ptr__[:bowner]
end

#at(size) ⇒ Object

wrapper for uchar vector_uchar::at(size_t size)



22091
22092
22093
# File 'lib/ruby/ropencv/ropencv_types.rb', line 22091

def at(size)
    Rbind::vector_uchar_at( self, size)
end

#backObject

wrapper for uchar vector_uchar::back()



22101
22102
22103
# File 'lib/ruby/ropencv/ropencv_types.rb', line 22101

def back()
    Rbind::vector_uchar_back( self)
end

#capacityObject

wrapper for size_t vector_uchar::capacity()



22071
22072
22073
# File 'lib/ruby/ropencv/ropencv_types.rb', line 22071

def capacity()
    Rbind::vector_uchar_capacity( self)
end

#dataObject

wrapper for void * vector_uchar::data()



22106
22107
22108
# File 'lib/ruby/ropencv/ropencv_types.rb', line 22106

def data()
    Rbind::vector_uchar_data( self)
end

#each(&block) ⇒ Object



22031
22032
22033
22034
22035
22036
22037
22038
22039
22040
# File 'lib/ruby/ropencv/ropencv_types.rb', line 22031

def each(&block)
    if block
         s = size
         0.upto(s-1) do |i|
             yield self[i]
         end
    else
        Enumerator.new(self)
    end
end

#emptyObject

wrapper for bool vector_uchar::empty()



22076
22077
22078
# File 'lib/ruby/ropencv/ropencv_types.rb', line 22076

def empty()
    Rbind::vector_uchar_empty( self)
end

#frontObject

wrapper for uchar vector_uchar::front()



22096
22097
22098
# File 'lib/ruby/ropencv/ropencv_types.rb', line 22096

def front()
    Rbind::vector_uchar_front( self)
end

#pop_backObject

wrapper for void vector_uchar::pop_back()



22116
22117
22118
# File 'lib/ruby/ropencv/ropencv_types.rb', line 22116

def pop_back()
    Rbind::vector_uchar_pop_back( self)
end

#push_back(other) ⇒ Object

wrapper for void vector_uchar::push_back(uchar other)



22111
22112
22113
# File 'lib/ruby/ropencv/ropencv_types.rb', line 22111

def push_back(other)
    Rbind::vector_uchar_push_back( self, other)
end

#reserve(size) ⇒ Object

wrapper for void vector_uchar::reserve(size_t size)



22081
22082
22083
# File 'lib/ruby/ropencv/ropencv_types.rb', line 22081

def reserve(size)
    Rbind::vector_uchar_reserve( self, size)
end

#resize(size, val = Uchar) ⇒ Object

methods wrapper for void vector_uchar::resize(size_t size, uchar val=uchar)



22061
22062
22063
# File 'lib/ruby/ropencv/ropencv_types.rb', line 22061

def resize(size, val = Uchar)
    Rbind::vector_uchar_resize( self, size, val)
end

#sizeObject

wrapper for size_t vector_uchar::size()



22066
22067
22068
# File 'lib/ruby/ropencv/ropencv_types.rb', line 22066

def size()
    Rbind::vector_uchar_size( self)
end

#swap(other) ⇒ Object

wrapper for void vector_uchar::swap(vector_uchar other)



22121
22122
22123
# File 'lib/ruby/ropencv/ropencv_types.rb', line 22121

def swap(other)
    Rbind::vector_uchar_swap( self, other)
end