octave-maintainers
[Top][All Lists]
Advanced

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

Question about sharing data structure in octave


From: Michael Goffioul
Subject: Question about sharing data structure in octave
Date: Fri, 27 Jun 2008 17:43:44 +0200

Hi,

I would like to request some comments about the best way to
implement shared data structure in octave. What I'm thinking
about is to have a C++ object that I want to make accessible
from the interpreter, through some octave_base_value inherited
class. At the interpreter level, I want this data structure to act
as a reference/pointer, not as a value: assigning to another
variable would share the same data structure without copying
it. This means in fine to use some reference counting. Now the
question is where to implement this mechanism:

1) octave_value uses sharing mechanism with its internal
octave_base_value representation; so I could inherit from
octave_base_value and implement my C++ data structure
in it, using implicitly the octave_value reference counting.
However, what I don't know is the situation where octave_value
decides to clone/copy itself: it must do so, because by
default octave deals with values and not references

2) define 2 classes: one pure C++ to hold my data structure
and is reference-counted, and one class inheriting from
octave_base_value that contains the pure C++ object and
handle the reference counting. This decouples completely
the sharing mechanism with the one from octave_value,
but increases the complexity and number of classes/objects

So, any comment about this?
Thanks.

Michael.


reply via email to

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