summaryrefslogtreecommitdiff
path: root/cpp/src/slice2java/Gen.cpp
diff options
context:
space:
mode:
Diffstat (limited to 'cpp/src/slice2java/Gen.cpp')
-rw-r--r--cpp/src/slice2java/Gen.cpp616
1 files changed, 597 insertions, 19 deletions
diff --git a/cpp/src/slice2java/Gen.cpp b/cpp/src/slice2java/Gen.cpp
index c6c6309e02e..95d09812c17 100644
--- a/cpp/src/slice2java/Gen.cpp
+++ b/cpp/src/slice2java/Gen.cpp
@@ -909,7 +909,7 @@ Slice::Gen::operator!() const
}
void
-Slice::Gen::generate(const UnitPtr& p)
+Slice::Gen::generate(const UnitPtr& p, bool stream)
{
JavaGenerator::validateMetaData(p);
@@ -919,13 +919,13 @@ Slice::Gen::generate(const UnitPtr& p)
PackageVisitor packageVisitor(_dir);
p->visit(&packageVisitor, false);
- TypesVisitor typesVisitor(_dir);
+ TypesVisitor typesVisitor(_dir, stream);
p->visit(&typesVisitor, false);
- HolderVisitor holderVisitor(_dir);
+ HolderVisitor holderVisitor(_dir, stream);
p->visit(&holderVisitor, false);
- HelperVisitor helperVisitor(_dir);
+ HelperVisitor helperVisitor(_dir, stream);
p->visit(&helperVisitor, false);
ProxyVisitor proxyVisitor(_dir);
@@ -1352,8 +1352,8 @@ Slice::Gen::PackageVisitor::visitModuleStart(const ModulePtr& p)
return false;
}
-Slice::Gen::TypesVisitor::TypesVisitor(const string& dir) :
- JavaVisitor(dir)
+Slice::Gen::TypesVisitor::TypesVisitor(const string& dir, bool stream) :
+ JavaVisitor(dir), _stream(stream)
{
}
@@ -1535,6 +1535,10 @@ Slice::Gen::TypesVisitor::visitClassDefStart(const ClassDefPtr& p)
if(allClassMembers.size() != 0)
{
out << sp << nl << "private class Patcher implements IceInternal.Patcher";
+ if(_stream)
+ {
+ out << ", Ice.ReadObjectCallback";
+ }
out << sb;
if(allClassMembers.size() > 1)
{
@@ -1591,6 +1595,14 @@ Slice::Gen::TypesVisitor::visitClassDefStart(const ClassDefPtr& p)
}
out << eb;
+ if(_stream)
+ {
+ out << sp << nl << "public void" << nl << "invoke(Ice.Object v)";
+ out << sb;
+ out << nl << "patch(v);";
+ out << eb;
+ }
+
if(allClassMembers.size() > 1)
{
out << sp << nl << "private int __member;";
@@ -1627,6 +1639,51 @@ Slice::Gen::TypesVisitor::visitClassDefStart(const ClassDefPtr& p)
out << nl << "__is.endReadSlice();";
out << nl << "super.__read(__is, true);";
out << eb;
+
+ if(_stream)
+ {
+ out << sp << nl << "public void" << nl << "__write(Ice.OutputStream __out)";
+ out << sb;
+ out << nl << "__out.writeTypeId(ice_staticId());";
+ out << nl << "__out.startSlice();";
+ iter = 0;
+ for(d = members.begin(); d != members.end(); ++d)
+ {
+ StringList metaData = (*d)->getMetaData();
+ writeStreamMarshalUnmarshalCode(out, package, (*d)->type(), fixKwd((*d)->name()), true, iter, false,
+ metaData);
+ }
+ out << nl << "__out.endSlice();";
+ out << nl << "super.__write(__out);";
+ out << eb;
+
+ out << sp << nl << "public void" << nl << "__read(Ice.InputStream __in, boolean __rid)";
+ out << sb;
+ out << nl << "if(__rid)";
+ out << sb;
+ out << nl << "String myId = __in.readTypeId();";
+ out << eb;
+ out << nl << "__in.startSlice();";
+ iter = 0;
+ for(d = members.begin(); d != members.end(); ++d)
+ {
+ StringList metaData = (*d)->getMetaData();
+ ostringstream patchParams;
+ BuiltinPtr builtin = BuiltinPtr::dynamicCast((*d)->type());
+ if((builtin && builtin->kind() == Builtin::KindObject) || ClassDeclPtr::dynamicCast((*d)->type()))
+ {
+ if(classMembers.size() > 1 || allClassMembers.size() > 1)
+ {
+ patchParams << "new Patcher(" << classMemberCount++ << ')';
+ }
+ }
+ writeStreamMarshalUnmarshalCode(out, package, (*d)->type(), fixKwd((*d)->name()), false, iter, false,
+ metaData, patchParams.str());
+ }
+ out << nl << "__in.endSlice();";
+ out << nl << "super.__read(__in, true);";
+ out << eb;
+ }
}
return true;
@@ -1720,6 +1777,10 @@ Slice::Gen::TypesVisitor::visitExceptionEnd(const ExceptionPtr& p)
if(allClassMembers.size() != 0)
{
out << sp << nl << "private class Patcher implements IceInternal.Patcher";
+ if(_stream)
+ {
+ out << ", Ice.ReadObjectCallback";
+ }
out << sb;
if(allClassMembers.size() > 1)
{
@@ -1775,6 +1836,15 @@ Slice::Gen::TypesVisitor::visitExceptionEnd(const ExceptionPtr& p)
out << nl << "return \"" << (*allClassMembers.begin())->type()->typeId() << "\";";
}
out << eb;
+
+ if(_stream)
+ {
+ out << sp << nl << "public void" << nl << "invoke(Ice.Object v)";
+ out << sb;
+ out << nl << "patch(v);";
+ out << eb;
+ }
+
if(allClassMembers.size() > 1)
{
out << sp << nl << "private int __member;";
@@ -1814,6 +1884,57 @@ Slice::Gen::TypesVisitor::visitExceptionEnd(const ExceptionPtr& p)
}
out << eb;
+ if(_stream)
+ {
+ out << sp << nl << "public void" << nl << "__write(Ice.OutputStream __out)";
+ out << sb;
+ out << nl << "__out.writeString(\"" << scoped << "\");";
+ out << nl << "__out.startSlice();";
+ iter = 0;
+ for(d = members.begin(); d != members.end(); ++d)
+ {
+ StringList metaData = (*d)->getMetaData();
+ writeStreamMarshalUnmarshalCode(out, package, (*d)->type(), fixKwd((*d)->name()), true, iter, false,
+ metaData);
+ }
+ out << nl << "__out.endSlice();";
+ if(base)
+ {
+ out << nl << "super.__write(__out);";
+ }
+ out << eb;
+
+ out << sp << nl << "public void" << nl << "__read(Ice.InputStream __in, boolean __rid)";
+ out << sb;
+ out << nl << "if(__rid)";
+ out << sb;
+ out << nl << "String myId = __in.readString();";
+ out << eb;
+ out << nl << "__in.startSlice();";
+ iter = 0;
+ for(d = members.begin(); d != members.end(); ++d)
+ {
+ ostringstream patchParams;
+ BuiltinPtr builtin = BuiltinPtr::dynamicCast((*d)->type());
+ if((builtin && builtin->kind() == Builtin::KindObject) || ClassDeclPtr::dynamicCast((*d)->type()))
+ {
+ if(classMembers.size() > 1 || allClassMembers.size() > 1)
+ {
+ patchParams << "new Patcher(" << classMemberCount++ << ')';
+ }
+ }
+ StringList metaData = (*d)->getMetaData();
+ writeStreamMarshalUnmarshalCode(out, package, (*d)->type(), fixKwd((*d)->name()), false, iter, false,
+ metaData, patchParams.str());
+ }
+ out << nl << "__in.endSlice();";
+ if(base)
+ {
+ out << nl << "super.__read(__in, true);";
+ }
+ out << eb;
+ }
+
if(p->usesClasses())
{
if(!base || base && !base->usesClasses())
@@ -1997,6 +2118,10 @@ Slice::Gen::TypesVisitor::visitStructEnd(const StructPtr& p)
if(classMembers.size() != 0)
{
out << sp << nl << "private class Patcher implements IceInternal.Patcher";
+ if(_stream)
+ {
+ out << ", Ice.ReadObjectCallback";
+ }
out << sb;
if(classMembers.size() > 1)
{
@@ -2053,6 +2178,14 @@ Slice::Gen::TypesVisitor::visitStructEnd(const StructPtr& p)
}
out << eb;
+ if(_stream)
+ {
+ out << sp << nl << "public void" << nl << "invoke(Ice.Object v)";
+ out << sb;
+ out << nl << "patch(v);";
+ out << eb;
+ }
+
if(classMembers.size() > 1)
{
out << sp << nl << "private int __member;";
@@ -2081,6 +2214,41 @@ Slice::Gen::TypesVisitor::visitStructEnd(const StructPtr& p)
patchParams.str());
}
out << eb;
+
+ if(_stream)
+ {
+ out << sp << nl << "public void" << nl << "__write(Ice.OutputStream __out)";
+ out << sb;
+ iter = 0;
+ for(d = members.begin(); d != members.end(); ++d)
+ {
+ StringList metaData = (*d)->getMetaData();
+ writeStreamMarshalUnmarshalCode(out, package, (*d)->type(), fixKwd((*d)->name()), true, iter, false,
+ metaData);
+ }
+ out << eb;
+
+ out << sp << nl << "public void" << nl << "__read(Ice.InputStream __in)";
+ out << sb;
+ iter = 0;
+ classMemberCount = 0;
+ for(d = members.begin(); d != members.end(); ++d)
+ {
+ ostringstream patchParams;
+ BuiltinPtr builtin = BuiltinPtr::dynamicCast((*d)->type());
+ if((builtin && builtin->kind() == Builtin::KindObject) || ClassDeclPtr::dynamicCast((*d)->type()))
+ {
+ if(classMembers.size() > 1)
+ {
+ patchParams << "new Patcher(" << classMemberCount++ << ')';
+ }
+ }
+ StringList metaData = (*d)->getMetaData();
+ writeStreamMarshalUnmarshalCode(out, package, (*d)->type(), fixKwd((*d)->name()), false, iter, false,
+ metaData, patchParams.str());
+ }
+ out << eb;
+ }
}
out << eb;
@@ -2140,6 +2308,11 @@ Slice::Gen::TypesVisitor::visitEnum(const EnumPtr& p)
out << nl << "return __value;";
out << eb;
+ out << sp << nl << "public String" << nl << "toString()";
+ out << sb;
+ out << nl << "return __T[__value];";
+ out << eb;
+
out << sp << nl << "private" << nl << name << "(int val)";
out << sb;
out << nl << "__value = val;";
@@ -2185,20 +2358,60 @@ Slice::Gen::TypesVisitor::visitEnum(const EnumPtr& p)
out << nl << "return " << name << ".convert(__v);";
out << eb;
- out << sp << nl << "final static private String[] __T =";
- out << sb;
- en = enumerators.begin();
- while(en != enumerators.end())
+ if(_stream)
{
- out << nl << "\"" << (*en)->name() << "\"";
- if(++en != enumerators.end())
+ out << sp << nl << "public void" << nl << "__write(Ice.OutputStream __out)";
+ out << sb;
+ if(sz <= 0x7f)
{
- out << ',';
+ out << nl << "__out.writeByte((byte)__value);";
+ }
+ else if(sz <= 0x7fff)
+ {
+ out << nl << "__out.writeShort((short)__value);";
+ }
+ else
+ {
+ out << nl << "__out.writeInt(__value);";
+ }
+ out << eb;
+
+ out << sp << nl << "public static " << name << nl << "__read(Ice.InputStream __in)";
+ out << sb;
+ if(sz <= 0x7f)
+ {
+ out << nl << "int __v = __in.readByte();";
+ }
+ else if(sz <= 0x7fff)
+ {
+ out << nl << "int __v = __in.readShort();";
+ }
+ else
+ {
+ out << nl << "int __v = __in.readInt();";
}
+ out << nl << "if(__v < 0 || __v >= " << sz << ')';
+ out << sb;
+ out << nl << "throw new Ice.MarshalException();";
+ out << eb;
+ out << nl << "return " << name << ".convert(__v);";
+ out << eb;
}
- out << eb << ';';
}
+ out << sp << nl << "final static private String[] __T =";
+ out << sb;
+ en = enumerators.begin();
+ while(en != enumerators.end())
+ {
+ out << nl << "\"" << (*en)->name() << "\"";
+ if(++en != enumerators.end())
+ {
+ out << ',';
+ }
+ }
+ out << eb << ';';
+
out << eb;
close();
}
@@ -2333,8 +2546,8 @@ Slice::Gen::TypesVisitor::visitConst(const ConstPtr& p)
close();
}
-Slice::Gen::HolderVisitor::HolderVisitor(const string& dir) :
- JavaVisitor(dir)
+Slice::Gen::HolderVisitor::HolderVisitor(const string& dir, bool stream) :
+ JavaVisitor(dir), _stream(stream)
{
}
@@ -2422,6 +2635,10 @@ Slice::Gen::HolderVisitor::writeHolder(const TypePtr& p)
if((builtin && builtin->kind() == Builtin::KindObject) || ClassDeclPtr::dynamicCast(p))
{
out << sp << nl << "public class Patcher implements IceInternal.Patcher";
+ if(_stream)
+ {
+ out << ", Ice.ReadObjectCallback";
+ }
out << sb;
out << nl << "public void";
out << nl << "patch(Ice.Object v)";
@@ -2433,6 +2650,14 @@ Slice::Gen::HolderVisitor::writeHolder(const TypePtr& p)
out << sb;
out << nl << "return \"" << p->typeId() << "\";";
out << eb;
+
+ if(_stream)
+ {
+ out << sp << nl << "public void" << nl << "invoke(Ice.Object v)";
+ out << sb;
+ out << nl << "patch(v);";
+ out << eb;
+ }
out << eb;
out << sp << nl << "public Patcher";
@@ -2448,8 +2673,8 @@ Slice::Gen::HolderVisitor::writeHolder(const TypePtr& p)
}
}
-Slice::Gen::HelperVisitor::HelperVisitor(const string& dir) :
- JavaVisitor(dir)
+Slice::Gen::HelperVisitor::HelperVisitor(const string& dir, bool stream) :
+ JavaVisitor(dir), _stream(stream)
{
}
@@ -2688,9 +2913,95 @@ Slice::Gen::HelperVisitor::visitClassDefStart(const ClassDefPtr& p)
out << nl << "return null;";
out << eb;
+ if(_stream)
+ {
+ out << sp << nl << "public static void" << nl << "write(Ice.OutputStream __out, " << name << "Prx v)";
+ out << sb;
+ out << nl << "__out.writeProxy(v);";
+ out << eb;
+
+ out << sp << nl << "public static " << name << "Prx" << nl << "read(Ice.InputStream __in)";
+ out << sb;
+ out << nl << "Ice.ObjectPrx proxy = __in.readProxy();";
+ out << nl << "if(proxy != null)";
+ out << sb;
+ out << nl << name << "PrxHelper result = new " << name << "PrxHelper();";
+ out << nl << "result.__copyFrom(proxy);";
+ out << nl << "return result;";
+ out << eb;
+ out << nl << "return null;";
+ out << eb;
+ }
+
out << eb;
close();
+ if(_stream)
+ {
+ //
+ // Class helper.
+ //
+ if(!open(getAbsolute(p, "", "", "Helper")))
+ {
+ return false;
+ }
+
+ Output& out2 = output();
+
+ out2 << sp << nl << "public final class " << name << "Helper";
+ out2 << sb;
+
+ out2 << sp << nl << "public static void" << nl << "write(Ice.OutputStream __out, " << fixKwd(name) << " __v)";
+ out2 << sb;
+ out2 << nl << "__out.writeObject(__v);";
+ out2 << eb;
+
+ out2 << sp << nl << "public static void" << nl << "read(Ice.InputStream __in, " << name << "Holder __h)";
+ out2 << sb;
+ out2 << nl << "__in.readObject(__h.getPatcher());";
+ out2 << eb;
+
+ out2 << eb;
+ close();
+ }
+
+ return false;
+}
+
+bool
+Slice::Gen::HelperVisitor::visitStructStart(const StructPtr& p)
+{
+ if(!p->isLocal() && _stream)
+ {
+ string name = p->name();
+ string fixedName = fixKwd(name);
+
+ if(!open(getAbsolute(p, "", "", "Helper")))
+ {
+ return false;
+ }
+
+ Output& out = output();
+
+ out << sp << nl << "public final class " << name << "Helper";
+ out << sb;
+
+ out << sp << nl << "public static void" << nl << "write(Ice.OutputStream __out, " << fixedName << " __v)";
+ out << sb;
+ out << nl << "__v.__write(__out);";
+ out << eb;
+
+ out << sp << nl << "public static " << fixedName << nl << "read(Ice.InputStream __in)";
+ out << sb;
+ out << nl << fixedName << " __v = new " << fixedName << "();";
+ out << nl << "__v.__read(__in);";
+ out << nl << "return __v;";
+ out << eb;
+
+ out << eb;
+ close();
+ }
+
return false;
}
@@ -2698,7 +3009,7 @@ void
Slice::Gen::HelperVisitor::visitSequence(const SequencePtr& p)
{
//
- // Don't generate helper for a sequence of a local type
+ // Don't generate helper for a sequence of a local type.
//
if(p->isLocal())
{
@@ -2733,6 +3044,23 @@ Slice::Gen::HelperVisitor::visitSequence(const SequencePtr& p)
out << nl << "return __v;";
out << eb;
+ if(_stream)
+ {
+ out << sp << nl << "public static void" << nl << "write(Ice.OutputStream __out, " << typeS << " __v)";
+ out << sb;
+ iter = 0;
+ writeStreamSequenceMarshalUnmarshalCode(out, package, p, "__v", true, iter, false);
+ out << eb;
+
+ out << sp << nl << "public static " << typeS << nl << "read(Ice.InputStream __in)";
+ out << sb;
+ out << nl << typeS << " __v;";
+ iter = 0;
+ writeStreamSequenceMarshalUnmarshalCode(out, package, p, "__v", false, iter, false);
+ out << nl << "return __v;";
+ out << eb;
+ }
+
out << eb;
close();
}
@@ -2869,6 +3197,10 @@ Slice::Gen::HelperVisitor::visitDictionary(const DictionaryPtr& p)
// The dictionary uses class values.
//
out << sp << nl << "private static class Patcher implements IceInternal.Patcher";
+ if(_stream)
+ {
+ out << ", Ice.ReadObjectCallback";
+ }
out << sb;
string keyTypeS = keyS;
BuiltinPtr b = BuiltinPtr::dynamicCast(key);
@@ -2934,6 +3266,14 @@ Slice::Gen::HelperVisitor::visitDictionary(const DictionaryPtr& p)
out << nl << "return \"" << value->typeId() << "\";";
out << eb;
+ if(_stream)
+ {
+ out << sp << nl << "public void" << nl << "invoke(Ice.Object v)";
+ out << sb;
+ out << nl << "patch(v);";
+ out << eb;
+ }
+
out << sp << nl << "private java.util.Map __m;";
out << nl << "private " << keyTypeS << " __key;";
out << eb;
@@ -3047,6 +3387,244 @@ Slice::Gen::HelperVisitor::visitDictionary(const DictionaryPtr& p)
out << nl << "return __r;";
out << eb;
+ if(_stream)
+ {
+ out << sp << nl << "public static void" << nl << "write(Ice.OutputStream __out, " << "java.util.Map __v)";
+ out << sb;
+ out << nl << "if(__v == null)";
+ out << sb;
+ out << nl << "__out.writeSize(0);";
+ out << eb;
+ out << nl << "else";
+ out << sb;
+ out << nl << "__out.writeSize(__v.size());";
+ out << nl << "java.util.Iterator __i = __v.entrySet().iterator();";
+ out << nl << "while(__i.hasNext())";
+ out << sb;
+ out << nl << "java.util.Map.Entry __e = (java.util.Map.Entry)" << "__i.next();";
+ iter = 0;
+ for(i = 0; i < 2; i++)
+ {
+ string val;
+ string arg;
+ TypePtr type;
+ if(i == 0)
+ {
+ arg = "__e.getKey()";
+ type = key;
+ }
+ else
+ {
+ arg = "__e.getValue()";
+ type = value;
+ }
+
+ BuiltinPtr b = BuiltinPtr::dynamicCast(type);
+ if(b)
+ {
+ switch(b->kind())
+ {
+ case Builtin::KindByte:
+ {
+ val = "((java.lang.Byte)" + arg + ").byteValue()";
+ break;
+ }
+ case Builtin::KindBool:
+ {
+ val = "((java.lang.Boolean)" + arg + ").booleanValue()";
+ break;
+ }
+ case Builtin::KindShort:
+ {
+ val = "((java.lang.Short)" + arg + ").shortValue()";
+ break;
+ }
+ case Builtin::KindInt:
+ {
+ val = "((java.lang.Integer)" + arg + ").intValue()";
+ break;
+ }
+ case Builtin::KindLong:
+ {
+ val = "((java.lang.Long)" + arg + ").longValue()";
+ break;
+ }
+ case Builtin::KindFloat:
+ {
+ val = "((java.lang.Float)" + arg + ").floatValue()";
+ break;
+ }
+ case Builtin::KindDouble:
+ {
+ val = "((java.lang.Double)" + arg + ").doubleValue()";
+ break;
+ }
+ case Builtin::KindString:
+ case Builtin::KindObject:
+ case Builtin::KindObjectProxy:
+ {
+ break;
+ }
+ case Builtin::KindLocalObject:
+ {
+ assert(false);
+ break;
+ }
+ }
+ }
+
+ if(val.empty())
+ {
+ val = "((" + typeToString(type, TypeModeIn, package) + ')' + arg + ')';
+ }
+ writeStreamMarshalUnmarshalCode(out, package, type, val, true, iter, false);
+ }
+ out << eb;
+ out << eb;
+ out << eb;
+
+ out << sp << nl << "public static java.util.Map" << nl << "read(Ice.InputStream __in)";
+ out << sb;
+ out << nl << "int __sz = __in.readSize();";
+ out << nl << "java.util.Map __r = new java.util.HashMap(__sz);";
+ out << nl << "for(int __i = 0; __i < __sz; __i++)";
+ out << sb;
+ iter = 0;
+ for(i = 0; i < 2; i++)
+ {
+ string arg;
+ TypePtr type;
+ if(i == 0)
+ {
+ arg = "__key";
+ type = key;
+ }
+ else
+ {
+ arg = "__value";
+ type = value;
+ }
+
+ BuiltinPtr b = BuiltinPtr::dynamicCast(type);
+ if(b)
+ {
+ switch(b->kind())
+ {
+ case Builtin::KindByte:
+ {
+ out << nl << "java.lang.Byte " << arg << " = new java.lang.Byte(__in.readByte());";
+ break;
+ }
+ case Builtin::KindBool:
+ {
+ out << nl << "java.lang.Boolean " << arg << " = new java.lang.Boolean(__in.readBool());";
+ break;
+ }
+ case Builtin::KindShort:
+ {
+ out << nl << "java.lang.Short " << arg << " = new java.lang.Short(__in.readShort());";
+ break;
+ }
+ case Builtin::KindInt:
+ {
+ out << nl << "java.lang.Integer " << arg << " = new java.lang.Integer(__in.readInt());";
+ break;
+ }
+ case Builtin::KindLong:
+ {
+ out << nl << "java.lang.Long " << arg << " = new java.lang.Long(__in.readLong());";
+ break;
+ }
+ case Builtin::KindFloat:
+ {
+ out << nl << "java.lang.Float " << arg << " = new java.lang.Float(__in.readFloat());";
+ break;
+ }
+ case Builtin::KindDouble:
+ {
+ out << nl << "java.lang.Double " << arg << " = new java.lang.Double(__in.readDouble());";
+ break;
+ }
+ case Builtin::KindString:
+ {
+ out << nl << "java.lang.String " << arg << " = __in.readString();";
+ break;
+ }
+ case Builtin::KindObject:
+ {
+ out << nl << "__in.readObject(new Patcher(__r, __key));";
+ break;
+ }
+ case Builtin::KindObjectProxy:
+ {
+ out << nl << "Ice.ObjectPrx " << arg << " = __in.readProxy();";
+ break;
+ }
+ case Builtin::KindLocalObject:
+ {
+ assert(false);
+ break;
+ }
+ }
+ }
+ else
+ {
+ string s = typeToString(type, TypeModeIn, package);
+ BuiltinPtr builtin2 = BuiltinPtr::dynamicCast(type);
+ if((builtin2 && builtin2->kind() == Builtin::KindObject) || ClassDeclPtr::dynamicCast(type))
+ {
+ writeStreamMarshalUnmarshalCode(out, package, type, arg, false, iter, false, StringList(),
+ "new Patcher(__r, __key)");
+ }
+ else
+ {
+ out << nl << s << ' ' << arg << ';';
+ writeStreamMarshalUnmarshalCode(out, package, type, arg, false, iter, false);
+ }
+ }
+ }
+ if(!(builtin && builtin->kind() == Builtin::KindObject) && !ClassDeclPtr::dynamicCast(value))
+ {
+ out << nl << "__r.put(__key, __value);";
+ }
+ out << eb;
+ out << nl << "return __r;";
+ out << eb;
+ }
+
+ out << eb;
+ close();
+ }
+}
+
+void
+Slice::Gen::HelperVisitor::visitEnum(const EnumPtr& p)
+{
+ if(!p->isLocal() && _stream)
+ {
+ string name = p->name();
+ string fixedName = fixKwd(name);
+
+ if(!open(getAbsolute(p, "", "", "Helper")))
+ {
+ return;
+ }
+
+ Output& out = output();
+
+ out << sp << nl << "public final class " << name << "Helper";
+ out << sb;
+
+ out << sp << nl << "public static void" << nl << "write(Ice.OutputStream __out, " << fixedName << " __v)";
+ out << sb;
+ out << nl << "__v.__write(__out);";
+ out << eb;
+
+ out << sp << nl << "public static " << fixedName << nl << "read(Ice.InputStream __in)";
+ out << sb;
+ out << nl << "return " << fixedName << ".__read(__in);";
+ out << eb;
+
out << eb;
close();
}