octave-maintainers
[Top][All Lists]
Advanced

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

Re: low level I/O (GPIB, USBTMC, VXI11)


From: c.
Subject: Re: low level I/O (GPIB, USBTMC, VXI11)
Date: Sun, 25 Nov 2012 16:51:48 +0100

On 25 Nov 2012, at 16:43, Richard wrote:

> Really? so i can have a C++ class, and call it and its methods from an m-file 
> in Octave, and have it persist like a real C++ object from one call of its 
> methods to the next?

Actually I was referring to using the class from an .oct file not from an .m 
file ...
anyway yes you can construct a new class in c++ and have it accessible in the 
interpreter
an be persistent between calls. 
In order to do this your class must inherit from the octave_base_value class.

> This is not possible with plain mex files in Matlab because you must create 
> an instance of a C++ class which will be destroyed once the mex file 
> completes (which is the problem that using handle classes in the linked 
> example solves). As I understood it Octave has the same limitation, but since 
> it does not yet have classdef, there is no way to do the same thing. I'd be 
> very interested hear if there was though, or that I have misunderstood 
> something about oct files.

The instrument control package is a working example of how this can be done, 
for a much simpler example you can have a look at these files:

  
http://inversethought.com/hg/what-is-octave/file/f8c352d9af2d/PoliMI2012/examples/myobject.h
  
http://inversethought.com/hg/what-is-octave/file/f8c352d9af2d/PoliMI2012/examples/myobject.cc

which are examples taken from this presentation

  http://jordi.platinum.linux.pl/octave/what-is-octave.pdf

> Richard
c.

reply via email to

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