|
|
|
|||||
|
Hello,
I've a question about Slice: How is it possible to define a transmit or return value of an array? In the documentation I didn't found some examples by using an array. example how I would like to use it at XXX.java: Code:
public String[] getArray(Ice.Current current){
String [] array = new String[100];
array[0] = "test1";
array[1] = "test2";
array[2] = "test3";
................
return array
}
public int getArraySize(String[] array, Ice.Current current){
int iSize = array.length;
return iSize
}
Code:
#ifndef XXX_ICE
#define XXX_ICE
// here the array definitions ?????????????????
module YYY
{
interface xxx
{
nonmutating string String[] getArray();
nonmutating int getArraySize(String[] array);
};
};
#endif
Thanks a lot greetings surfer ![]()
__________________
Philipp Henkel Brunel University London MSc student. MSc dissertation: Centralized controlling of distributed application servers. Used tools: FC3, W2k, XP, Apache2, PHP5 , ICE-PHP and ICE-Java. Last edited by surfer : 11-13-2005 at 10:33 AM. |
|
|||||
|
Hallo Marc,
thanks a lot for your tip !!! Here the code which works for me. Please correct me if something is wrong. Hello.ice: Code:
#ifndef HELLO_ICE
#define HELLO_ICE
module Demo
{
exception GenericError {
string reason;
};
sequence<string> sa;
interface Hello
{
nonmutating void sayHello();
idempotent void shutdown();
nonmutating sa getArray();
nonmutating void sendArray(sa text);
};
};
#endif
Code:
public String[]
getArray(Ice.Current current)
{
array = new String[100];
array[0] = "Test0";
array[1] = "Test1";
array[2] = "Test2";
array[3] = "Test3";
return array;
}
public void
sendArray(String[] arrayGet, Ice.Current current)
{
array = arrayGet;
int iCounter = 0;
while(iCounter<4){
String s = array[iCounter];
System.out.println("Array content "+iCounter+":>"+s);
iCounter++;
}
}
Client.java: Code:
if(line.equals("t"))
{
twoway.sayHello();
String[] sa = twoway.getArray();
int iCounter = 0;
while(iCounter<4){
String s = sa[iCounter];
System.out.println("Client content "+iCounter+":>"+s);
iCounter++;
}
}
else if(line.equals("o"))
{
oneway.sayHello();
String[] array = new String[100];
array[0] = "C_Test0";
array[1] = "C_Test1";
array[2] = "C_Test2";
array[3] = "C_Test3";
twoway.sendArray(array);
}
greetings surfer
__________________
Philipp Henkel Brunel University London MSc student. MSc dissertation: Centralized controlling of distributed application servers. Used tools: FC3, W2k, XP, Apache2, PHP5 , ICE-PHP and ICE-Java. Last edited by surfer : 11-14-2005 at 05:14 AM. |
|
|||||
|
Hello michi,
thanks for your answer, I've just set the array size to 100 for testing not for special use. But I will attend that in my application. Thanks a lot greetings surfer
__________________
Philipp Henkel Brunel University London MSc student. MSc dissertation: Centralized controlling of distributed application servers. Used tools: FC3, W2k, XP, Apache2, PHP5 , ICE-PHP and ICE-Java. |
![]() |
| Currently Active Users Viewing This Thread: 1 (0 members and 1 guests) | |
| Thread Tools | |
| Display Modes | Rate This Thread |
|
|
Similar Threads
|
||||
| Thread | Thread Starter | Forum | Replies | Last Post |
| effects of C++ Array Mapping for Sequences | smu | Help Center | 6 | 01-12-2007 04:35 PM |
| Memory problem using dictionary or array as parameters | enrico | Help Center | 6 | 03-27-2006 12:35 PM |
| how to pass binary char array to remote host efficiatively? | socketref | Help Center | 7 | 09-18-2005 11:15 AM |
| slice array type mapping to c++ | yomi | Help Center | 2 | 04-05-2004 12:32 AM |