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.


------------------------------------------------------------------------------
Monitor your physical, virtual and cloud infrastructure from a single
web console. Get in-depth insight into apps, servers, databases, vmware,
SAP, cloud infrastructure, etc. Download 30-day Free Trial.
Pricing starts from $795 for 25 servers or applications!
http://p.sf.net/sfu/zoho_dev2dev_nov
_______________________________________________
Octave-dev mailing list
Octave-dev@lists.sourceforge.net
https://lists.sourceforge.net/lists/listinfo/octave-dev

Reply via email to