Class: OpenCV::Cv::FileStorage

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

Constants collapse

READ =
0
WRITE =
1
APPEND =
2
MEMORY =
4
FORMAT_MASK =
(7<<3)
FORMAT_AUTO =
0
FORMAT_XML =
(1<<3)
FORMAT_YAML =
(2<<3)
UNDEFINED =
0
VALUE_EXPECTED =
1
NAME_EXPECTED =
2
INSIDE_MAP =
4

Instance Attribute Summary collapse

Class Method Summary collapse

Instance Method Summary collapse

Constructor Details

#initialize(ptr) ⇒ FileStorage

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 FileStorage.



7596
7597
7598
7599
7600
7601
7602
# File 'lib/ruby/ropencv/ropencv_types.rb', line 7596

def initialize(ptr)
    @__obj_ptr__ = if ptr.is_a? FileStorageStruct
                       ptr
                   else
                       FileStorageStruct.new(FFI::AutoPointer.new(ptr,FileStorageStruct.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.



7593
7594
7595
# File 'lib/ruby/ropencv/ropencv_types.rb', line 7593

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



7588
7589
7590
# File 'lib/ruby/ropencv/ropencv_types.rb', line 7588

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

.new(*args) ⇒ Object

Raises:

  • (ArgumentError)


7532
7533
7534
7535
7536
7537
7538
7539
7540
7541
7542
7543
7544
7545
7546
7547
7548
7549
7550
7551
7552
7553
7554
7555
7556
7557
7558
7559
7560
7561
7562
7563
7564
# File 'lib/ruby/ropencv/ropencv_types.rb', line 7532

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

    # wrapper for cv::FileStorage::FileStorage(const cv::String source, int flags, const cv::String encoding=string())
    @@cv_file_storage_file_storage2_defaults1 ||= [nil, nil, Cv::String.new()]
    if(args.size >= 2 && args.size <= 3)
        args.size.upto(2) do |i|
            args[i] = @@cv_file_storage_file_storage2_defaults1[i]
        end
        begin
            return Rbind::cv_file_storage_file_storage2(*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.



7576
7577
7578
# File 'lib/ruby/ropencv/ropencv_types.rb', line 7576

def self.rbind_from_native(ptr,context)
    FileStorage.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.



7567
7568
7569
7570
7571
7572
7573
# File 'lib/ruby/ropencv/ropencv_types.rb', line 7567

def self.rbind_to_native(obj,context)
    if obj.is_a? FileStorage
        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



7582
7583
7584
# File 'lib/ruby/ropencv/ropencv_types.rb', line 7582

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

Instance Method Details

#[](nodename) ⇒ Object

wrapper for cv::FileNode cv::FileStorage::operator[](c_string nodename)



7672
7673
7674
7675
7676
7677
# File 'lib/ruby/ropencv/ropencv_types.rb', line 7672

def [](nodename)
    result = Rbind::cv_file_storage_operator_array( self, nodename)
    # store owner insight the pointer to not get garbage collected
    result.instance_variable_get(:@__obj_ptr__).instance_variable_set(:@__owner__,self) if !result.__owner__?
    result
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)


7607
7608
7609
# File 'lib/ruby/ropencv/ropencv_types.rb', line 7607

def __owner__?
    @__obj_ptr__[:bowner]
end

#get_first_top_level_nodeObject

wrapper for cv::FileNode cv::FileStorage::getFirstTopLevelNode()



7656
7657
7658
7659
7660
7661
# File 'lib/ruby/ropencv/ropencv_types.rb', line 7656

def get_first_top_level_node()
    result = Rbind::cv_file_storage_get_first_top_level_node( self)
    # store owner insight the pointer to not get garbage collected
    result.instance_variable_get(:@__obj_ptr__).instance_variable_set(:@__owner__,self) if !result.__owner__?
    result
end

#is_openedObject

wrapper for bool cv::FileStorage::isOpened()



7638
7639
7640
# File 'lib/ruby/ropencv/ropencv_types.rb', line 7638

def is_opened()
    Rbind::cv_file_storage_is_opened( self)
end

#open(filename, flags, encoding = Cv::String.new()) ⇒ Object

methods wrapper for bool cv::FileStorage::open(const cv::String filename, int flags, const cv::String encoding=string())



7633
7634
7635
# File 'lib/ruby/ropencv/ropencv_types.rb', line 7633

def open(filename, flags, encoding = Cv::String.new())
    Rbind::cv_file_storage_open( self, filename, flags, encoding)
end

#releaseObject

wrapper for void cv::FileStorage::release()



7643
7644
7645
# File 'lib/ruby/ropencv/ropencv_types.rb', line 7643

def release()
    Rbind::cv_file_storage_release( self)
end

#release_and_get_stringObject

wrapper for cv::String cv::FileStorage::releaseAndGetString()



7648
7649
7650
7651
7652
7653
# File 'lib/ruby/ropencv/ropencv_types.rb', line 7648

def release_and_get_string()
    result = Rbind::cv_file_storage_release_and_get_string( self)
    # store owner insight the pointer to not get garbage collected
    result.instance_variable_get(:@__obj_ptr__).instance_variable_set(:@__owner__,self) if !result.__owner__?
    result
end

#root(streamidx = 0) ⇒ Object

wrapper for cv::FileNode cv::FileStorage::root(int streamidx=0)



7664
7665
7666
7667
7668
7669
# File 'lib/ruby/ropencv/ropencv_types.rb', line 7664

def root(streamidx = 0)
    result = Rbind::cv_file_storage_root( self, streamidx)
    # store owner insight the pointer to not get garbage collected
    result.instance_variable_get(:@__obj_ptr__).instance_variable_set(:@__owner__,self) if !result.__owner__?
    result
end