[Ace-users] how to unmarshall an any that is a a sequence of structures

nospam nospam at spamnot.net
Sat Aug 11 05:29:22 CDT 2007


Hello everyone,

If a server receives an ANY and does not know a priori what original 
type it was (plain CORBA types, but ALSO sequences and structures!), how 
do I
recreate the original data structure (plain CORBA types, user-defined 
sequences, and structures)?

Hopefully obvious, but I am concerned with the sequences and structures 
and primarily sequences of structures.


I assume being able to unmarshall sequence of structs from an ANY is 
doable. I would greatly appreciate a minimal example code. Or maybe 
there are rare or new CORBA-standard built-in functions that make this 
simple?

Here is the IDL I am trying to use:

struct NVPAIR
{
string name;
any value;      // this any could hold a POT,sequence,
		// struct, or sequence of struct
};
typedef sequence<NVPAIR> NVPAIR_LIST;

struct COMMAND
{
string      cmd;
NVPAIR_LIST args;
}
typedef sequence<COMMAND> COMMAND_LIST;

In this example, I am receiving a COMMAND_LIST, and need to reconstruct 
the sequence of COMMANDS.

I am using Linux with GNU 4.1.2 compiler, C++, and the newest TAO release

Thanks,
Jeff



More information about the Ace-users mailing list