View Single Post
  #1 (permalink)  
Old 11-26-2005
fengxb's Avatar
fengxb fengxb is offline
Registered User
 
Name: feng xuebin
Organization: jiexin tech
Project: scientific calculation
 
Join Date: Aug 2003
Location: R.P.China
Posts: 78
a question about Classes as Unions

Hi,

I define some classes as below:

/////////////////////////////////////////////////////
enum VARTYPE { VTNULL, VTBOOL, VTBYTE, VTSHORT, VTINT, VTLONG, VTFLOAT, VTDOUBLE, VTSTRING, VTBLOB, VTSTRINGBLOB };

class Variant{
string toString();
int fromString(string s);
VARTYPE getType();
};

class VariantBoolean extends Variant { bool value; };

class VariantByte extends Variant { byte value; };

class ComplexObj{
int i;
Variant value;
};

interface MyOp{
int submit(ComplexObj obj);
};
//////////////////////////////////////////////////////////////////

In the client side, member "value" of ComplexObj object is instantiated as VariantBooleanI object.
After client invoke submit() of MyOp, the server throws an exception as below:

//////////////////////////////////////////////////////////////////
infoprocmgt: warning: dispatch exception: g:\def.
cpp:1521: Ice::NoObjectFactoryException:
protocol error: no suitable object factory found for `Variant'
identity: MyOp.submit
facet:
operation: submit

//////////////////////////////////////////////////////

do Ice support the semantics?

Thanks in advance.

FengXB
__________________
Fengxb
Reply With Quote