Sha256: 9f5d2cef90c4d18c2028bb62e708538ada97f040a51693bda27abc45b0d5d35d
Contents?: true
Size: 687 Bytes
Versions: 4
Compression:
Stored size: 687 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_LEN(names); string_vector keys = string_vector(); for (i = 0; i < number_of_keys; i++) { keys.append(std::string(RSTRING_PTR(RARRAY_PTR(names)[i]))); } Octave_map struct_matrix = Octave_map(dim_vector(1, 1), Cell(keys)); for (i = 0; i < number_of_keys; i++) { struct_matrix.contents(std::string(RSTRING_PTR(RARRAY_PTR(names)[i]))) = OR_Variable(rb_hash_aref(ruby_val, rb_str_new2(RSTRING_PTR(RARRAY_PTR(names)[i])))).to_octave(); } return struct_matrix; }
Version data entries
4 entries across 4 versions & 1 rubygems
Version | Path |
---|---|
octave-ruby-2.0.3 | ext/octave_api/or-hash.cpp |
octave-ruby-2.0.2 | ext/octave_api/or-hash.cpp |
octave-ruby-2.0.1 | ext/octave_api/or-hash.cpp |
octave-ruby-2.0.0 | ext/octave_api/or-hash.cpp |