View Single Post
  #1 (permalink)  
Old 10-17-2004
dwolfe5272 dwolfe5272 is offline
Registered User
 
 
Join Date: Oct 2004
Location: Royal Oak, Michigan
Posts: 10
Sequence of 'unions'?

Is it possible to return a sequence of (simulated) union values?
I'm trying to do something along the lines of the following:

class SymValue { };
class ByteValue extends SymValue { byte byteval; };
class ShortValue extends SymValue { short shortval; };
class LongValue extends SymValue { long longval; };
class FloatValue extends SymValue { float floatval; };
class DoubleValue extends SymValue { double doubleval; };

struct SymDatum {
string name;
double rate;
short units;
SymValue* value;
};

sequence<string> SymNameSeq;
sequence<SymDatum> SymDataSeq;

// Return symbols matching 'symname'
class Source
{
nonmutating SymDataSeq SymQuery( string symname );
.
.
};

I've been having problems getting a test program for this to compile,
and just wanted to ask: is this even possible, or does the Slice-to-C++
mapping not permit such usage?
Reply With Quote