Sha256: 33bcdc5d38cd771e6edd658f41344fbd81c9c7ea0b1d3edb863ea7fb0b143771
Contents?: true
Size: 713 Bytes
Versions: 2
Compression:
Stored size: 713 Bytes
Contents
#include "or-hash.h" #include "or-variable.h" OR_Hash::~OR_Hash() {} octave_value OR_Hash::to_octave() { int i; VALUE names = rb_funcall(ruby_val, rb_intern("keys"), 0); int number_of_keys = RARRAY(names)->len; string_vector keys = string_vector(); for (i = 0; i < number_of_keys; i++) { keys.append(std::string(RSTRING(RARRAY(names)->ptr[i])->ptr)); } Octave_map struct_matrix = Octave_map(dim_vector(number_of_keys, 1), Cell(keys)); for (i = 0; i < number_of_keys; i++) { struct_matrix.contents(std::string(RSTRING(RARRAY(names)->ptr[i])->ptr))(i, 0) = OR_Variable(rb_hash_aref(ruby_val, rb_str_new2(RSTRING(RARRAY(names)->ptr[i])->ptr))).to_octave(); } return struct_matrix; }
Version data entries
2 entries across 2 versions & 1 rubygems
Version | Path |
---|---|
octave-ruby-1.0.2 | ext/octave_api/or-hash.cpp |
octave-ruby-1.0.1 | ext/octave_api/or-hash.cpp |