Go Back   ZeroC Forums > Help Center

Reply
 
LinkBack Thread Tools Rate Thread Display Modes
  #1 (permalink)  
Old 02-20-2005
pi1ot pi1ot is offline
Registered User
 
Name: pi1ot
Organization: SINA.com
Project: WEB
 
Join Date: Feb 2005
Posts: 3
Arrow is there any way to use my own struct in slice?

such as:

struct my_own_struct{
int x;
string y;
my_another_class z;
};

i must define ice_my_own_struct and ice_my_another_class in slice and write two function to translate them in my code now:

my_client( my_own_struct m ){
ice_interface( my_to_ice(m) );
}

ice_interface( ice_my_own_struct i ){
my_server_code( ice_to_mine(i) );
}

is there any way to avoid these "excrescent" code?
thanks.
Reply With Quote
  #2 (permalink)  
Old 02-21-2005
matthew's Avatar
matthew matthew is offline
ZeroC Staff
 
Name: Matthew Newhook
Organization: ZeroC, Inc.
Project: Internet Communications Engine
 
Join Date: Feb 2003
Location: NL, Canada
Posts: 1,053
Quote:
Originally Posted by pi1ot
such as:

struct my_own_struct{
int x;
string y;
my_another_class z;
};

i must define ice_my_own_struct and ice_my_another_class in slice and write two function to translate them in my code now:

my_client( my_own_struct m ){
ice_interface( my_to_ice(m) );
}

ice_interface( ice_my_own_struct i ){
my_server_code( ice_to_mine(i) );
}

is there any way to avoid these "excrescent" code?
thanks.
The best way is to avoid doing this, by defining these structs and classes in Slice in the first place. However, this isn't always possible -- particularly when integrating with legacy software. In these cases, you must define some translation layer, as you've done above.

Regards, Matthew
Reply With Quote
Reply



Currently Active Users Viewing This Thread: 1 (0 members and 1 guests)
 
Thread Tools
Display Modes Rate This Thread
Rate This Thread:

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

vB code is On
Smilies are On
[IMG] code is Off
HTML code is Off
Trackbacks are On
Pingbacks are On
Refbacks are On

Similar Threads
Thread Thread Starter Forum Replies Last Post
About return struct billwillman Help Center 7 10-16-2006 03:39 AM
php ice interface struct initialization dthompson Help Center 1 05-17-2006 06:18 PM
PHP Returned Result into slice struct dthompson Help Center 1 05-05-2006 05:05 PM
proxy needed for struct? gminorcoles Help Center 2 01-06-2005 03:05 PM
May slice struct contain class? minifat Help Center 1 08-09-2004 10:16 PM


All times are GMT -4. The time now is 02:40 PM.


Powered by vBulletin® Version 3.6.4
Copyright ©2000 - 2008, Jelsoft Enterprises Ltd.
Search Engine Optimization by vBSEO 3.0.0
(c) 2008 ZeroC, Inc.