//
// Copyright (c) ZeroC, Inc. All rights reserved.
//
using System;
using System.ComponentModel;
namespace Ice
{
[Serializable]
public abstract class Value : ICloneable
{
private const string _id = "::Ice::Object";
///
/// Returns the Slice type ID of the interface supported by this object.
///
/// The return value is always ::Ice::Object.
public static string ice_staticId()
{
return _id;
}
///
/// Returns the Slice type ID of the most-derived interface supported by this object.
///
/// The return value is always ::Ice::Object.
public virtual string ice_id()
{
return _id;
}
///
/// The Ice run time invokes this method prior to marshaling an object's data members. This allows a subclass
/// to override this method in order to validate its data members.
///
public virtual void ice_preMarshal()
{
}
///
/// This Ice run time invokes this method after unmarshaling an object's data members. This allows a
/// subclass to override this method in order to perform additional initialization.
///
public virtual void ice_postUnmarshal()
{
}
///
/// Returns the sliced data if the value has a preserved-slice base class and has been sliced during
/// un-marshaling of the value, null is returned otherwise.
///
/// The sliced data or null.
public virtual SlicedData ice_getSlicedData()
{
return null;
}
[EditorBrowsable(EditorBrowsableState.Never)]
public virtual void iceWrite(OutputStream ostr)
{
ostr.startValue(null);
iceWriteImpl(ostr);
ostr.endValue();
}
[EditorBrowsable(EditorBrowsableState.Never)]
public virtual void iceRead(InputStream istr)
{
istr.startValue();
iceReadImpl(istr);
istr.endValue(false);
}
[EditorBrowsable(EditorBrowsableState.Never)]
protected virtual void iceWriteImpl(OutputStream ostr)
{
}
[EditorBrowsable(EditorBrowsableState.Never)]
protected virtual void iceReadImpl(InputStream istr)
{
}
///
/// Returns a copy of the object. The cloned object contains field-for-field copies
/// of the state.
///
/// The cloned object.
public object Clone()
{
return MemberwiseClone();
}
}
public class InterfaceByValue : Value
{
public InterfaceByValue(string id)
{
_id = id;
}
public override string ice_id()
{
return _id;
}
[EditorBrowsable(EditorBrowsableState.Never)]
protected override void iceWriteImpl(OutputStream ostr)
{
ostr.startSlice(ice_id(), -1, true);
ostr.endSlice();
}
[EditorBrowsable(EditorBrowsableState.Never)]
protected override void iceReadImpl(InputStream istr)
{
istr.startSlice();
istr.endSlice();
}
private string _id;
}
}