help-octave
[Top][All Lists]
Advanced

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

RTTI questions


From: Clark Dunson
Subject: RTTI questions
Date: Wed, 21 May 2014 18:55:28 -0700

Thanks!

I have derived a bunch of octave objects (my base class is derived from 
octave_base_value).  I have one base class and a dozen derived from it.  I can 
insert these into a cell array and I can see them print their contents quite 
dandily.  OK so far.  Now I want to iterate a Cell array and detect one of 
three conditions:

1) The Cell element is another Cell
2) The Cell element is one of my derived (my base class cannot be instantiated)
3) The Cell element is some other class/type

It seems a reasonable and basic approach to adding classes to Octave.  But 
there are issues.

1) above cannot work because I cannot use the run-time technique of 
dynamic_cast<Array*>(&Cell), as the Array in Octave is not derived from 
octave_value, which the mkoctfile mechanism seems to require me to start out 
with.  

2) above also seems not to work.  All attempts have produced only 
12octave_value as a type, and dynamic_cast<myBase *>(&octave_value) ever gives 
NULL.

3) would be the detritus from 1) & 2)

Sorry for being a little lost!  I can provide code if needed, granted the C++ 
RTTI is a woe for testing inheritance.  Surely I am missing something?

I appreciate any thoughts that you have!

Clark






reply via email to

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