2012/11/5 c.
<address@hidden>
On 5 Nov 2012, at 07:48, c. wrote:
> Alternatively you could define a new class derived from octave_value and store your pointer there.
> examples are available in many octave-forge packages, for example:
>
> main/instrument-control/src/i2c/i2c_class.h
> main/instrument-control/src/parallel/parallel_class.h
> main/instrument-control/src/serial/serial_class.h
>
> or
>
> main/openmpi_ext/src/simple.h
>
> HTH,
> c.
Olaf,
My comment was probably not clear enough, sorry.
I was not suggesting to create an Octave object representing a pointer.
I was suggesting to create a class that contains all methods required for interacting with the pointer and stores
the pointer as a private property.
The user should then be able to interact with objects of this new class only through methods that are "exposed" as
interpreted language functions, and it would be possible to make shure that they only perform "safe" operations.
I think that is the approaach taken by the instrument-control package, but I only had a very quick look at it,
probably Andrius or Juan Pablo can be more precise with this respect.
BTW, Pantxo, have you had a look at the "instrument-control" package? Can't you use that package directly to interact
with your hardware?
c.
Instrument-control package provides interfaces to serial/parallel/i2c ports, wich is far not enough to talk to a modbus device (or libmodbus author has created an empty lib :-). I need the protocol layer and it works very well with libmodbus.
Do I really have to define an octave class (following e.g. Instrument-control classes example), or is the static variable solution viable (and safe)?
BTW I tried to put multiple DEFUN_DLD in the same file, it compiles fine but if I run octave in the corresponding directory, DLD functions don't seem to be defined. What is the trick here?
Pantxo