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: Richard
Subject: Re: low level I/O (GPIB, USBTMC, VXI11)
Date: Sun, 25 Nov 2012 15:56:40 +0000
User-agent: Mozilla/5.0 (Windows NT 6.1; WOW64; rv:16.0) Gecko/20121026 Thunderbird/16.0.2

On 25/11/2012 15:51, c. wrote:
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.

Thanks, maybe I will copy some of this info to the wiki.
Richard

--
The University of Edinburgh is a charitable body, registered in
Scotland, with registration number SC005336.



reply via email to

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