help-octave
[Top][All Lists]
Advanced

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

C++ objects and subsref


From: Pablo Daniel Pareja Obregón
Subject: C++ objects and subsref
Date: Fri, 25 Jun 2010 20:27:53 -0300

Hi everyone,

I'm writing a data acquisition package for octave to interact with the
hardware supported by comedi project [1]. The idea is to make it
compatible with the objects and methods present in the data
acquisition toolbox present in matlab. Having that in mind, I
implemented my own objects for managing analog and digital
inputs/outputs and getting/setting their properties.

I have implemented my own sets and gets (called through a dispatch to
my own functions when the appropiate type is used). However when
accessing indices I haven't had any success in implementing a subsref
equivalent for my C++ object.

I looked around in the web, but haven't found any examples. I
implemented an alternative using classes instead of codatypes, but the
problem here arises when using sets (due to the fact that octave only
handles pass by value and not by reference). As the data acquisition
toolbox in matlab makes extensive use of pass by reference (
set(x,"property",value) instead of x = set(x,....) , flushdata(x)
instead of x = flushdata(x) , etc ), I think it's better to stick to
the C++ implementation.

Anyway, my problem is, I would like to provide the possibility to
access objects properties in a similar way when using subsref and
subsasgn (for example obj.name ) but for my C++ object. Is this even
possible?

Any help would be much appreciated.

Regards,
Pablo

[1] http://www.comedi.org/


reply via email to

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