Moving to objects loses array functionality? [message #63306] |
Mon, 03 November 2008 14:43 |
|
Originally posted by: Demitri
Hi,
I'm trying to implement some of my data as proper IDL objects, but I'm
either missing some syntax or else am losing some array functionality
in the process.
Let's say I have the following structures:
void = {BOOK, $
author : '', $
pChapters : PTR_NEW()}
void = {CHAPTER, $
title : '', $
pageCount : 0}
pChapters is a pointer to contain a variable number of chapters in the
BOOK structure. If I create an array of BOOKs, I can do this:
IDL> print, books.author
...and get a list of all of the authors. I can also use utilities like
WHERE of course.
What I'm wondering is if I can extract a list of, say, all of the
chapter names as a list (perhaps my example doesn't seem useful, but
ignore that!). I was hoping something like this would work:
IDL> print, (*books.pChapters).title
...especially since "books.pChapters" does return an array of pointers.
Is there something I can do here without resorting to FOR loops within
methods in the BOOK object?
Cheers!
Demitri
|
|
|