Discussion:
[omniORB] [beginner] pass typedef argument in python
Aryeh Leib Taurog
2011-11-07 12:39:52 UTC
Permalink
I am very new to omniORB and I'm trying to translate some java code to
python. I'm using the ubuntu 10.04 packages.

I have something like the following in my idl:

module Baseball {
typedef sequence<string<12>, 1000> PlayersGroup;
interface PlayerStatsManager {
any GetStatsForGroup(in any group);
};
};

The java code looks something like this:

org.omg.CORBA.Any getStats(String[] players) {
org.omg.CORBA.Any playerList = _orb.create_any();
PlayersGroupHelper.insert(playerList, players);
return _statsMgr.GetStatsForGroup(playersList);
}

How would I do this with omniORB in python?

Thanks in advance,
Aryeh Leib Taurog
Duncan Grisby
2011-11-11 18:12:18 UTC
Permalink
Post by Aryeh Leib Taurog
module Baseball {
typedef sequence<string<12>, 1000> PlayersGroup;
interface PlayerStatsManager {
any GetStatsForGroup(in any group);
};
};
org.omg.CORBA.Any getStats(String[] players) {
org.omg.CORBA.Any playerList = _orb.create_any();
PlayersGroupHelper.insert(playerList, players);
return _statsMgr.GetStatsForGroup(playersList);
}
How would I do this with omniORB in python?
players = ["one", "two", "three"]
playersList = CORBA.Any(Baseball._tc_PlayersGroup, players)
statsMgr.GetStatsForGroup(playersList)

Cheers,

Duncan.
--
-- Duncan Grisby --
-- ***@grisby.org --
-- http://www.grisby.org --
Aryeh Leib Taurog
2011-11-11 18:31:58 UTC
Permalink
Post by Duncan Grisby
Post by Aryeh Leib Taurog
module Baseball {
typedef sequence<string<12>, 1000> PlayersGroup;
interface PlayerStatsManager {
any GetStatsForGroup(in any group);
};
};
org.omg.CORBA.Any getStats(String[] players) {
org.omg.CORBA.Any playerList = _orb.create_any();
PlayersGroupHelper.insert(playerList, players);
return _statsMgr.GetStatsForGroup(playersList);
}
How would I do this with omniORB in python?
players = ["one", "two", "three"]
playersList = CORBA.Any(Baseball._tc_PlayersGroup, players)
statsMgr.GetStatsForGroup(playersList)
Cheers,
Duncan.
Thank you! I'd tried something similar, but unsuccessfully. This works.
Loading...