While working on a distributed object network project in my company, I've came across with Ice and I've had (and having) great experiences
with it, thanks to guys at ZeroC !!!
During my work on the project I've developed several tools for Ice, one of them is 'tree script' and other is slice2lua.
1.tree script. is a small scripting language that allows you to make calls to ice server without having the slice interfaces, using dynamic
Ice. For example, suppose I have the following slice definition on server:
I can invoke operation 'someFunc' from client, without having those slice interfaces, from tree script like this:Code:module MyMod { class TestA { float a; int b; }; class TestB extends TestA { TestA c; int d; TestA e; }; interface SomeInterface { TestA someFunc(TestA a, TestB b, out TestB c); }; };
'tree scipt' supports all slice basic data types, structs, classes, sequences, dictionaries and all their superpositions.Code:/* command 'call' states that we want to make a function call */ call /* a call can be 'normal' or 'idempotent' */ normal /*since we don't have a slice interface we need to describe the return types explicitly, here we describe the TestB type, we describe all members of a class TestB and all it's slices using special syntax */ ( ((float int) int (float int) | float int) /* the type of 'out c', which is TestB */ (float int) /* the return type, which is TestA */ ) /*next, we must specify an identity of an object on which we want to call a method */ /path/to/object/on/server // next we specify the name of the method someFunc // the input parameters follow (::MyMod::TestA 12.34f 11i) /* the value of the first parameter */ ( /* the value of the second parameter*/ ::MyMod::TestB /* typeid of first slice */ (::MyMod::TestA 1.2f 2i) 9i (::MyMod::TestA 1.3f 3i) /* first slice data */ ::MyMod::TestA /* typeid of second slice */ 0.1f 12i /* second slice data */ );
one thing 'tree script' doesn't support is proxies, because that would make a need for variables in the language and would add extra complexity,
and I just needed a simple scripting language that could invoke methods and display return values.
2.slice2lua is a slice compiler (which uses libSlice) which generates C++ code that allows you to access Ice objects from lua scripts.
You just compile your .ice files, create lua_State* from your program/library, pass that context to initialization function and
there you have access to all Ice stuff from lua (in that particular context). You can invoke methods on classes/interfaces/proxies, set/get
data members, instanciate objects, create and register proxies with object adapter, etc.
slice2lua also generates so called 'server-side code', which allows you to write Ice servants in lua, i.e when some remote caller calls
a method on your servant, that servant calls lua function and it does all the processing.
Also slice2lua supports almost all of the options slice2cpp supports on command line.
slice2lua can be very handy if you want to script some behaviour in your ice client or server.
Right now those utilities are part of another project, but if someone is interested I can easily make them separate and place source code
on sourceforge or something...

Reply With Quote