[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
Re: Octave_map and vectors
From: |
Claudio Belotti |
Subject: |
Re: Octave_map and vectors |
Date: |
Tue, 28 Oct 2003 17:10:42 +0100 |
User-agent: |
Mutt/1.3.28i |
That's exactly what I want but ...
test.cc: In function `class octave_value_list Ftest(const octave_value_list &,
int)':
test.cc:23: no match for `octave_value & = octave_value_list &'
/usr/include/octave-2.0.17/octave/ov.h:170: candidates are: class octave_value
& octave_value::operator =(const octave_value &)
the problem is retval(0) = array;
I've managed to return an octave_value_list but that's not what I want because
I should know how many output are expected, and that's not my case.
On Tue, Oct 28, 2003 at 03:50:04PM +0000, Geraint Paul Bevan wrote:
> Sorry, I misread your question. I think that this is what you are
> looking for:
>
> // -*-c++-*-
> // test.cc
>
> #include <octave/oct.h>
> #include <octave/oct-map.h>
>
> DEFUN_DLD (test, args, , "test")
> {
> ~ static octave_value_list retval;
> ~ octave_value_list array;
>
> ~ Octave_map map1, map2;
>
> ~ map1.assign("name", octave_value("hello"));
> ~ map1.assign("type", octave_value("int32"));
>
> ~ map2.assign("name", octave_value("world"));
> ~ map2.assign("type", octave_value("int32"));
>
> ~ array(0) = map1;
> ~ array(1) = map2;
>
> ~ retval(0) = array;
> ~ return retval;
> }
>
>
> $ mkoctfile test.cc && echo test | octave -q
> ans =
> (
> ~ [1] =
> ~ {
> ~ name = hello
> ~ type = int32
> ~ }
>
> ~ [2] =
> ~ {
> ~ name = world
> ~ type = int32
> ~ }
>
> )
>
>
> - --
> Geraint Bevan
> http://www.mech.gla.ac.uk/~gbevan
>
> -----BEGIN PGP SIGNATURE-----
> Version: GnuPG v1.2.2 (GNU/Linux)
>
> iEYEARECAAYFAj+ekCsACgkQcXV3N50QmNNawwCgg5BfhoCipR0U687yVjadzbgX
> 2BEAoI/B+nBoqmC/B/EEphrx9Vegn04o
> =iR6b
> -----END PGP SIGNATURE-----
>
>
>
> -------------------------------------------------------------
> Octave is freely available under the terms of the GNU GPL.
>
> Octave's home on the web: http://www.octave.org
> How to fund new projects: http://www.octave.org/funding.html
> Subscription information: http://www.octave.org/archive.html
> -------------------------------------------------------------
-------------------------------------------------------------
Octave is freely available under the terms of the GNU GPL.
Octave's home on the web: http://www.octave.org
How to fund new projects: http://www.octave.org/funding.html
Subscription information: http://www.octave.org/archive.html
-------------------------------------------------------------