[omniORB] Passing a Sequence from Python to C++

Ridgway, Richard (London) Richard_Ridgway at ml.com
Fri Feb 15 11:52:59 GMT 2008


Sequences are mapped to python lists or tuples.
1.3.2 of the omg python languange mapping has this:

The sequence template is mapped to sequence objects (e.g., tuples or
lists).
Applications should not assume that values of a sequence type are
mutable. Sequences
and arrays of octets and characters are mapped to the string type for
efficiency reasons.
For example, given the IDL definitions
typedef sequence<long> LongList;
interface VectorOps{
long sum(in LongList l);
};
a client could invoke the operation
print obj.sum([1,2,3])



Thus in your case
sequence_of_params = [param1,param2]


-----Original Message-----
From: omniorb-list-bounces at omniorb-support.com
[mailto:omniorb-list-bounces at omniorb-support.com] On Behalf Of EntonH
Sent: 15 February 2008 11:29
To: omniorb-list at omniorb-support.com
Subject: [omniORB] Passing a Sequence from Python to C++



Hello,

I'm new to CORBA and Python and want to pass a sequence from Python to
C++.

My IDL-file:

interface idlfile
	{
		
		struct param
		{
			string value1;
	   		             any value2;

		};

                typedef sequence param dict;

The generated code:
Struct:
class param:
def __init__(self, value1, value2)

Sequence:
class dict:
def __init__(self, *args, **kw)

I want to initialize the params in this way:
pm1 = idlfile.param("example1","example2")
But I don't know how to initialize the sequence?

How do I initialize a sequence of params und how do I pass them to C++?

Is it possible to put the sequence into a dictionary and to pass this to
C++?

I'm looking forward for your replies.

Greetings,
EntonH
-- 
View this message in context:
http://www.nabble.com/Passing-a-Sequence-from-Python-to-C%2B%2B-tp154958
50p15495850.html
Sent from the OmniORB - User mailing list archive at Nabble.com.


_______________________________________________
omniORB-list mailing list
omniORB-list at omniorb-support.com
http://www.omniorb-support.com/mailman/listinfo/omniorb-list
--------------------------------------------------------

This message w/attachments (message) may be privileged, confidential or proprietary, and if you are not an intended recipient, please notify the sender, do not use or share it and delete it. Unless specifically indicated, this message is not an offer to sell or a solicitation of any investment products or other financial product or service, an official confirmation of any transaction, or an official statement of Merrill Lynch. Subject to applicable law, Merrill Lynch may monitor, review and retain e-communications (EC) traveling through its networks/systems. The laws of the country of each sender/recipient may impact the handling of EC, and EC may be archived, supervised and produced in countries other than the country in which you are located. This message cannot be guaranteed to be secure or error-free. This message is subject to terms available at the following link: http://www.ml.com/e-communications_terms/. By messaging with Merrill Lynch you consent to the foregoing.
--------------------------------------------------------



More information about the omniORB-list mailing list