octave-maintainers
[Top][All Lists]
Advanced

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

Re: document how to derive octave_value class


From: Pantxo Diribarne
Subject: Re: document how to derive octave_value class
Date: Wed, 15 Jan 2014 19:17:28 +0100
User-agent: Mozilla/5.0 (X11; Linux x86_64; rv:24.0) Gecko/20100101 Thunderbird/24.2.0

Le 15/01/2014 15:21, John Swensen a écrit :
On Wed, Jan 15, 2014 at 2:56 AM, Andreas Weber <address@hidden> wrote:
On 13.01.2014 19:26, Pantxo Diribarne wrote:
> I find my self trying to declare a new class in the interpreter, derived
> from octave_value.

Hi Pantxo,
I think another small example to have a look at is octave-forge
octave-sockets/sockets.cc. -- Andy

Someone had talked about patching the sockets class to get rid of the socket being represented by a custom class. When I originally wrote that, I was trying to learn Oct files and the use of a custom class probably really isn't necessary (could have just used an integer). 

So, if you look at the socket package sources and it doesn't look like there is a new class in there anymore, then someone must have made and applied the patch I speak of.

John Swensen
Thank you all for those suggestions.
I have tried to make the bare bones example (no operator declaration  macro, only the minimum) that I was hoping to find. There is only constructor, destructor for the class and the DEFUN interface (see attached). Unfortunately It doesn't work, the object is destroyed right before being returned to the interpreter.

I compiled it using "mkoctfile hello_obj.cc", then in octave I see :

octave:1> aa = hello_obj ();
Hello!
octave_hello installed at type-id = 54
Hello!
good bye!
error: value on right hand side of assignment is undefined

Should I now continue on the help list ?

Pantxo

Attachment: hello_obj.cc
Description: Text Data


reply via email to

[Prev in Thread] Current Thread [Next in Thread]