| | | 1 | | // Copyright (c) ZeroC, Inc. |
| | | 2 | | |
| | | 3 | | #nullable enable |
| | | 4 | | |
| | | 5 | | using System.ComponentModel; |
| | | 6 | | |
| | | 7 | | namespace Ice; |
| | | 8 | | |
| | | 9 | | /// <summary> |
| | | 10 | | /// The base class for instances of Slice-defined classes. |
| | | 11 | | /// </summary> |
| | | 12 | | public abstract class Value |
| | | 13 | | { |
| | | 14 | | private const string _id = "::Ice::Object"; |
| | | 15 | | |
| | | 16 | | /// <summary> |
| | | 17 | | /// Returns the Slice type ID of this type. |
| | | 18 | | /// </summary> |
| | | 19 | | /// <returns>The return value is always <c>::Ice::Object</c>.</returns> |
| | 1 | 20 | | public static string ice_staticId() => _id; |
| | | 21 | | |
| | | 22 | | /// <summary> |
| | | 23 | | /// Returns the Slice type ID of the most-derived class supported by this object. |
| | | 24 | | /// </summary> |
| | | 25 | | /// <returns>The Slice type ID.</returns> |
| | 0 | 26 | | public virtual string ice_id() => _id; |
| | | 27 | | |
| | | 28 | | /// <summary> |
| | | 29 | | /// The Ice runtime calls this method before marshaling a class instance. |
| | | 30 | | /// Subclasses can override this method in order to update or validate their fields before marshaling. |
| | | 31 | | /// </summary> |
| | | 32 | | public virtual void ice_preMarshal() |
| | | 33 | | { |
| | 1 | 34 | | } |
| | | 35 | | |
| | | 36 | | /// <summary> |
| | | 37 | | /// The Ice runtime calls this method after unmarshaling a class instance. |
| | | 38 | | /// Subclasses can override this method in order to update or validate their fields after unmarshaling. |
| | | 39 | | /// </summary> |
| | | 40 | | public virtual void ice_postUnmarshal() |
| | | 41 | | { |
| | 1 | 42 | | } |
| | | 43 | | |
| | | 44 | | /// <summary> |
| | | 45 | | /// Returns the sliced data associated with this instance. |
| | | 46 | | /// </summary> |
| | | 47 | | /// <returns>If this value has a preserved-slice base class and has been sliced during unmarshaling, |
| | | 48 | | /// this returns the sliced data; otherwise this returns null.</returns> |
| | 1 | 49 | | public SlicedData? ice_getSlicedData() => _slicedData; |
| | | 50 | | |
| | | 51 | | [EditorBrowsable(EditorBrowsableState.Never)] |
| | | 52 | | public virtual void iceWrite(OutputStream ostr) |
| | | 53 | | { |
| | 1 | 54 | | ostr.startValue(_slicedData); |
| | 1 | 55 | | iceWriteImpl(ostr); |
| | 1 | 56 | | ostr.endValue(); |
| | 1 | 57 | | } |
| | | 58 | | |
| | | 59 | | [EditorBrowsable(EditorBrowsableState.Never)] |
| | | 60 | | public virtual void iceRead(InputStream istr) |
| | | 61 | | { |
| | 1 | 62 | | istr.startValue(); |
| | 1 | 63 | | iceReadImpl(istr); |
| | 1 | 64 | | _slicedData = istr.endValue(); |
| | 1 | 65 | | } |
| | | 66 | | |
| | | 67 | | [EditorBrowsable(EditorBrowsableState.Never)] |
| | | 68 | | protected virtual void iceWriteImpl(OutputStream ostr) |
| | | 69 | | { |
| | 1 | 70 | | } |
| | | 71 | | |
| | | 72 | | [EditorBrowsable(EditorBrowsableState.Never)] |
| | | 73 | | protected virtual void iceReadImpl(InputStream istr) |
| | | 74 | | { |
| | 1 | 75 | | } |
| | | 76 | | |
| | | 77 | | /// <summary> |
| | | 78 | | /// Returns a shallow field-for-field copy of this object. |
| | | 79 | | /// </summary> |
| | | 80 | | /// <returns>The cloned object.</returns> |
| | 1 | 81 | | public Value Clone() => (Value)MemberwiseClone(); |
| | | 82 | | |
| | | 83 | | private SlicedData? _slicedData; |
| | | 84 | | } |