http://git-wip-us.apache.org/repos/asf/ignite/blob/894057e5/modules/platforms/dotnet/Apache.Ignite.Core/Impl/Ignite.cs ---------------------------------------------------------------------- diff --git a/modules/platforms/dotnet/Apache.Ignite.Core/Impl/Ignite.cs b/modules/platforms/dotnet/Apache.Ignite.Core/Impl/Ignite.cs index 30c6b66..ded671a 100644 --- a/modules/platforms/dotnet/Apache.Ignite.Core/Impl/Ignite.cs +++ b/modules/platforms/dotnet/Apache.Ignite.Core/Impl/Ignite.cs @@ -23,24 +23,24 @@ namespace Apache.Ignite.Core.Impl using System.Diagnostics; using System.Diagnostics.CodeAnalysis; using System.Linq; + using Apache.Ignite.Core.Binary; using Apache.Ignite.Core.Cache; using Apache.Ignite.Core.Cluster; using Apache.Ignite.Core.Compute; using Apache.Ignite.Core.Datastream; using Apache.Ignite.Core.DataStructures; using Apache.Ignite.Core.Events; + using Apache.Ignite.Core.Impl.Binary; using Apache.Ignite.Core.Impl.Cache; using Apache.Ignite.Core.Impl.Cluster; using Apache.Ignite.Core.Impl.Common; using Apache.Ignite.Core.Impl.Datastream; using Apache.Ignite.Core.Impl.DataStructures; using Apache.Ignite.Core.Impl.Handle; - using Apache.Ignite.Core.Impl.Portable; using Apache.Ignite.Core.Impl.Transactions; using Apache.Ignite.Core.Impl.Unmanaged; using Apache.Ignite.Core.Lifecycle; using Apache.Ignite.Core.Messaging; - using Apache.Ignite.Core.Portable; using Apache.Ignite.Core.Services; using Apache.Ignite.Core.Transactions; using UU = Apache.Ignite.Core.Impl.Unmanaged.UnmanagedUtils; @@ -60,13 +60,13 @@ namespace Apache.Ignite.Core.Impl private readonly IUnmanagedTarget _proc; /** Marshaller. */ - private readonly PortableMarshaller _marsh; + private readonly Marshaller _marsh; /** Initial projection. */ private readonly ClusterGroupImpl _prj; - /** Portables. */ - private readonly PortablesImpl _portables; + /** Binary. */ + private readonly IgniteBinary _igniteBinary; /** Cached proxy. */ private readonly IgniteProxy _proxy; @@ -97,7 +97,7 @@ namespace Apache.Ignite.Core.Impl /// <param name="marsh">Marshaller.</param> /// <param name="lifecycleBeans">Lifecycle beans.</param> /// <param name="cbs">Callbacks.</param> - public Ignite(IgniteConfiguration cfg, string name, IUnmanagedTarget proc, PortableMarshaller marsh, + public Ignite(IgniteConfiguration cfg, string name, IUnmanagedTarget proc, Marshaller marsh, IList<LifecycleBeanHolder> lifecycleBeans, UnmanagedCallbacks cbs) { Debug.Assert(cfg != null); @@ -117,7 +117,7 @@ namespace Apache.Ignite.Core.Impl _prj = new ClusterGroupImpl(proc, UU.ProcessorProjection(proc), marsh, this, null); - _portables = new PortablesImpl(marsh); + _igniteBinary = new IgniteBinary(marsh); _proxy = new IgniteProxy(this); @@ -347,13 +347,13 @@ namespace Apache.Ignite.Core.Impl /// Gets cache from specified native cache object. /// </summary> /// <param name="nativeCache">Native cache.</param> - /// <param name="keepPortable">Portable flag.</param> + /// <param name="keepBinary">Keep binary flag.</param> /// <returns> /// New instance of cache wrapping specified native cache. /// </returns> - public ICache<TK, TV> Cache<TK, TV>(IUnmanagedTarget nativeCache, bool keepPortable = false) + public ICache<TK, TV> Cache<TK, TV>(IUnmanagedTarget nativeCache, bool keepBinary = false) { - return new CacheImpl<TK, TV>(this, nativeCache, _marsh, false, keepPortable, false, false); + return new CacheImpl<TK, TV>(this, nativeCache, _marsh, false, keepBinary, false, false); } /** <inheritdoc /> */ @@ -394,9 +394,9 @@ namespace Apache.Ignite.Core.Impl } /** <inheritdoc /> */ - public IPortables GetPortables() + public IIgniteBinary GetBinary() { - return _portables; + return _igniteBinary; } /** <inheritdoc /> */ @@ -455,7 +455,7 @@ namespace Apache.Ignite.Core.Impl /// <summary> /// Marshaller. /// </summary> - internal PortableMarshaller Marshaller + internal Marshaller Marshaller { get { return _marsh; } } @@ -472,15 +472,15 @@ namespace Apache.Ignite.Core.Impl /// Put metadata to Grid. /// </summary> /// <param name="metas">Metadata.</param> - internal void PutMetadata(IDictionary<int, IPortableMetadata> metas) + internal void PutBinaryTypes(IDictionary<int, IBinaryType> metas) { - _prj.PutMetadata(metas); + _prj.PutBinaryTypes(metas); } /** <inheritDoc /> */ - public IPortableMetadata GetMetadata(int typeId) + public IBinaryType GetBinaryType(int typeId) { - return _prj.GetMetadata(typeId); + return _prj.GetBinaryType(typeId); } /// <summary> @@ -499,7 +499,7 @@ namespace Apache.Ignite.Core.Impl { var stream = IgniteManager.Memory.Get(memPtr).GetStream(); - IPortableRawReader reader = Marshaller.StartUnmarshal(stream, false); + IBinaryRawReader reader = Marshaller.StartUnmarshal(stream, false); var node = new ClusterNodeImpl(reader);
http://git-wip-us.apache.org/repos/asf/ignite/blob/894057e5/modules/platforms/dotnet/Apache.Ignite.Core/Impl/IgniteProxy.cs ---------------------------------------------------------------------- diff --git a/modules/platforms/dotnet/Apache.Ignite.Core/Impl/IgniteProxy.cs b/modules/platforms/dotnet/Apache.Ignite.Core/Impl/IgniteProxy.cs index 86021c8..113f700 100644 --- a/modules/platforms/dotnet/Apache.Ignite.Core/Impl/IgniteProxy.cs +++ b/modules/platforms/dotnet/Apache.Ignite.Core/Impl/IgniteProxy.cs @@ -20,16 +20,16 @@ namespace Apache.Ignite.Core.Impl using System; using System.Collections.Generic; using System.Diagnostics.CodeAnalysis; + using Apache.Ignite.Core.Binary; using Apache.Ignite.Core.Cache; using Apache.Ignite.Core.Cluster; using Apache.Ignite.Core.Compute; using Apache.Ignite.Core.Datastream; using Apache.Ignite.Core.DataStructures; using Apache.Ignite.Core.Events; + using Apache.Ignite.Core.Impl.Binary; using Apache.Ignite.Core.Impl.Cluster; - using Apache.Ignite.Core.Impl.Portable; using Apache.Ignite.Core.Messaging; - using Apache.Ignite.Core.Portable; using Apache.Ignite.Core.Services; using Apache.Ignite.Core.Transactions; @@ -37,7 +37,7 @@ namespace Apache.Ignite.Core.Impl /// Grid proxy with fake serialization. /// </summary> [Serializable] - internal class IgniteProxy : IIgnite, IClusterGroupEx, IPortableWriteAware, ICluster + internal class IgniteProxy : IIgnite, IClusterGroupEx, IBinaryWriteAware, ICluster { /** */ [NonSerialized] @@ -275,9 +275,9 @@ namespace Apache.Ignite.Core.Impl } /** <inheritdoc /> */ - public IPortables GetPortables() + public IIgniteBinary GetBinary() { - return _ignite.GetPortables(); + return _ignite.GetBinary(); } /** <inheritdoc /> */ @@ -318,7 +318,7 @@ namespace Apache.Ignite.Core.Impl } /** <inheritdoc /> */ - public void WritePortable(IPortableWriter writer) + public void WriteBinary(IBinaryWriter writer) { // No-op. } @@ -335,9 +335,9 @@ namespace Apache.Ignite.Core.Impl } /** <inheritdoc /> */ - public IPortableMetadata GetMetadata(int typeId) + public IBinaryType GetBinaryType(int typeId) { - return ((IClusterGroupEx)_ignite).GetMetadata(typeId); + return ((IClusterGroupEx)_ignite).GetBinaryType(typeId); } } } http://git-wip-us.apache.org/repos/asf/ignite/blob/894057e5/modules/platforms/dotnet/Apache.Ignite.Core/Impl/IgniteUtils.cs ---------------------------------------------------------------------- diff --git a/modules/platforms/dotnet/Apache.Ignite.Core/Impl/IgniteUtils.cs b/modules/platforms/dotnet/Apache.Ignite.Core/Impl/IgniteUtils.cs index 47ab166..7929a5d 100644 --- a/modules/platforms/dotnet/Apache.Ignite.Core/Impl/IgniteUtils.cs +++ b/modules/platforms/dotnet/Apache.Ignite.Core/Impl/IgniteUtils.cs @@ -25,13 +25,14 @@ namespace Apache.Ignite.Core.Impl using System.Reflection; using System.Runtime.InteropServices; using System.Text; + using Apache.Ignite.Core.Binary; using Apache.Ignite.Core.Cluster; using Apache.Ignite.Core.Common; + using Apache.Ignite.Core.Impl.Binary; using Apache.Ignite.Core.Impl.Cluster; using Apache.Ignite.Core.Impl.Common; - using Apache.Ignite.Core.Impl.Portable; using Apache.Ignite.Core.Impl.Unmanaged; - using Apache.Ignite.Core.Portable; + using BinaryReader = Apache.Ignite.Core.Impl.Binary.BinaryReader; /// <summary> /// Native utility methods. @@ -384,7 +385,7 @@ namespace Apache.Ignite.Core.Impl /// <param name="reader">Reader.</param> /// <param name="pred">The predicate.</param> /// <returns> Nodes list or null. </returns> - public static List<IClusterNode> ReadNodes(IPortableRawReader reader, Func<ClusterNodeImpl, bool> pred = null) + public static List<IClusterNode> ReadNodes(IBinaryRawReader reader, Func<ClusterNodeImpl, bool> pred = null) { var cnt = reader.ReadInt(); @@ -393,7 +394,7 @@ namespace Apache.Ignite.Core.Impl var res = new List<IClusterNode>(cnt); - var ignite = ((PortableReaderImpl)reader).Marshaller.Ignite; + var ignite = ((BinaryReader)reader).Marshaller.Ignite; if (pred == null) { http://git-wip-us.apache.org/repos/asf/ignite/blob/894057e5/modules/platforms/dotnet/Apache.Ignite.Core/Impl/InteropExceptionHolder.cs ---------------------------------------------------------------------- diff --git a/modules/platforms/dotnet/Apache.Ignite.Core/Impl/InteropExceptionHolder.cs b/modules/platforms/dotnet/Apache.Ignite.Core/Impl/InteropExceptionHolder.cs index 918c3d6..42c21f3 100644 --- a/modules/platforms/dotnet/Apache.Ignite.Core/Impl/InteropExceptionHolder.cs +++ b/modules/platforms/dotnet/Apache.Ignite.Core/Impl/InteropExceptionHolder.cs @@ -19,14 +19,14 @@ namespace Apache.Ignite.Core.Impl { using System; using System.Runtime.Serialization.Formatters.Binary; - using Apache.Ignite.Core.Impl.Portable; - using Apache.Ignite.Core.Impl.Portable.IO; - using Apache.Ignite.Core.Portable; + using Apache.Ignite.Core.Binary; + using Apache.Ignite.Core.Impl.Binary; + using Apache.Ignite.Core.Impl.Binary.IO; /// <summary> /// Holder of exception which must be serialized to Java and then backwards to the native platform. /// </summary> - internal class InteropExceptionHolder : IPortableMarshalAware + internal class InteropExceptionHolder : IBinarizable { /** Initial exception. */ private Exception _err; @@ -57,11 +57,11 @@ namespace Apache.Ignite.Core.Impl } /** <inheritDoc /> */ - public void WritePortable(IPortableWriter writer) + public void WriteBinary(IBinaryWriter writer) { - var writer0 = (PortableWriterImpl) writer.GetRawWriter(); + var writer0 = (BinaryWriter) writer.GetRawWriter(); - if (writer0.IsPortable(_err)) + if (writer0.IsBinarizable(_err)) { writer0.WriteBoolean(true); writer0.WriteObject(_err); @@ -72,12 +72,12 @@ namespace Apache.Ignite.Core.Impl BinaryFormatter bf = new BinaryFormatter(); - bf.Serialize(new PortableStreamAdapter(writer0.Stream), _err); + bf.Serialize(new BinaryStreamAdapter(writer0.Stream), _err); } } /** <inheritDoc /> */ - public void ReadPortable(IPortableReader reader) + public void ReadBinary(IBinaryReader reader) { throw new NotImplementedException(); } http://git-wip-us.apache.org/repos/asf/ignite/blob/894057e5/modules/platforms/dotnet/Apache.Ignite.Core/Impl/Memory/PlatformMemoryStream.cs ---------------------------------------------------------------------- diff --git a/modules/platforms/dotnet/Apache.Ignite.Core/Impl/Memory/PlatformMemoryStream.cs b/modules/platforms/dotnet/Apache.Ignite.Core/Impl/Memory/PlatformMemoryStream.cs index 44766c2..374cc4a 100644 --- a/modules/platforms/dotnet/Apache.Ignite.Core/Impl/Memory/PlatformMemoryStream.cs +++ b/modules/platforms/dotnet/Apache.Ignite.Core/Impl/Memory/PlatformMemoryStream.cs @@ -21,15 +21,15 @@ namespace Apache.Ignite.Core.Impl.Memory using System.Diagnostics.CodeAnalysis; using System.IO; using System.Text; + using Apache.Ignite.Core.Impl.Binary.IO; using Apache.Ignite.Core.Impl.Common; - using Apache.Ignite.Core.Impl.Portable.IO; /// <summary> /// Platform memory stream. /// </summary> [CLSCompliant(false)] [SuppressMessage("Microsoft.Naming", "CA1711:IdentifiersShouldNotHaveIncorrectSuffix")] - public unsafe class PlatformMemoryStream : IPortableStream + public unsafe class PlatformMemoryStream : IBinaryStream { /** Length: 1 byte. */ protected const int Len1 = 1; http://git-wip-us.apache.org/repos/asf/ignite/blob/894057e5/modules/platforms/dotnet/Apache.Ignite.Core/Impl/Messaging/MessageListenerHolder.cs ---------------------------------------------------------------------- diff --git a/modules/platforms/dotnet/Apache.Ignite.Core/Impl/Messaging/MessageListenerHolder.cs b/modules/platforms/dotnet/Apache.Ignite.Core/Impl/Messaging/MessageListenerHolder.cs index dc6585c..8b67462 100644 --- a/modules/platforms/dotnet/Apache.Ignite.Core/Impl/Messaging/MessageListenerHolder.cs +++ b/modules/platforms/dotnet/Apache.Ignite.Core/Impl/Messaging/MessageListenerHolder.cs @@ -19,18 +19,18 @@ namespace Apache.Ignite.Core.Impl.Messaging { using System; using System.Diagnostics; + using Apache.Ignite.Core.Binary; + using Apache.Ignite.Core.Impl.Binary; + using Apache.Ignite.Core.Impl.Binary.IO; using Apache.Ignite.Core.Impl.Common; using Apache.Ignite.Core.Impl.Handle; - using Apache.Ignite.Core.Impl.Portable; - using Apache.Ignite.Core.Impl.Portable.IO; using Apache.Ignite.Core.Impl.Resource; using Apache.Ignite.Core.Messaging; - using Apache.Ignite.Core.Portable; /// <summary> - /// Non-generic portable message listener wrapper. + /// Non-generic binary message listener wrapper. /// </summary> - internal class MessageListenerHolder : IPortableWriteAware, IHandle + internal class MessageListenerHolder : IBinaryWriteAware, IHandle { /** Invoker function that takes key and value and invokes wrapped IMessageListener */ private readonly Func<Guid, object, bool> _invoker; @@ -71,7 +71,7 @@ namespace Apache.Ignite.Core.Impl.Messaging /// </summary> /// <param name="input">Input.</param> /// <returns></returns> - public int Invoke(IPortableStream input) + public int Invoke(IBinaryStream input) { var rawReader = _ignite.Marshaller.StartUnmarshal(input).GetRawReader(); @@ -150,9 +150,9 @@ namespace Apache.Ignite.Core.Impl.Messaging } /** <inheritdoc /> */ - public void WritePortable(IPortableWriter writer) + public void WriteBinary(IBinaryWriter writer) { - var writer0 = (PortableWriterImpl)writer.GetRawWriter(); + var writer0 = (BinaryWriter)writer.GetRawWriter(); writer0.WithDetach(w => w.WriteObject(Filter)); } @@ -161,9 +161,9 @@ namespace Apache.Ignite.Core.Impl.Messaging /// Initializes a new instance of the <see cref="MessageListenerHolder"/> class. /// </summary> /// <param name="reader">The reader.</param> - public MessageListenerHolder(IPortableReader reader) + public MessageListenerHolder(IBinaryReader reader) { - var reader0 = (PortableReaderImpl)reader.GetRawReader(); + var reader0 = (BinaryReader)reader.GetRawReader(); _filter = reader0.ReadObject<object>(); http://git-wip-us.apache.org/repos/asf/ignite/blob/894057e5/modules/platforms/dotnet/Apache.Ignite.Core/Impl/Messaging/Messaging.cs ---------------------------------------------------------------------- diff --git a/modules/platforms/dotnet/Apache.Ignite.Core/Impl/Messaging/Messaging.cs b/modules/platforms/dotnet/Apache.Ignite.Core/Impl/Messaging/Messaging.cs index df7d6ff..5882495 100644 --- a/modules/platforms/dotnet/Apache.Ignite.Core/Impl/Messaging/Messaging.cs +++ b/modules/platforms/dotnet/Apache.Ignite.Core/Impl/Messaging/Messaging.cs @@ -24,9 +24,9 @@ namespace Apache.Ignite.Core.Impl.Messaging using System.Linq; using System.Threading.Tasks; using Apache.Ignite.Core.Cluster; + using Apache.Ignite.Core.Impl.Binary; using Apache.Ignite.Core.Impl.Collections; using Apache.Ignite.Core.Impl.Common; - using Apache.Ignite.Core.Impl.Portable; using Apache.Ignite.Core.Impl.Resource; using Apache.Ignite.Core.Impl.Unmanaged; using Apache.Ignite.Core.Messaging; @@ -73,7 +73,7 @@ namespace Apache.Ignite.Core.Impl.Messaging /// <param name="target">Target.</param> /// <param name="marsh">Marshaller.</param> /// <param name="prj">Cluster group.</param> - public Messaging(IUnmanagedTarget target, PortableMarshaller marsh, IClusterGroup prj) + public Messaging(IUnmanagedTarget target, Marshaller marsh, IClusterGroup prj) : base(target, marsh) { Debug.Assert(prj != null); http://git-wip-us.apache.org/repos/asf/ignite/blob/894057e5/modules/platforms/dotnet/Apache.Ignite.Core/Impl/PlatformTarget.cs ---------------------------------------------------------------------- diff --git a/modules/platforms/dotnet/Apache.Ignite.Core/Impl/PlatformTarget.cs b/modules/platforms/dotnet/Apache.Ignite.Core/Impl/PlatformTarget.cs index 49b57a5..115f30d 100644 --- a/modules/platforms/dotnet/Apache.Ignite.Core/Impl/PlatformTarget.cs +++ b/modules/platforms/dotnet/Apache.Ignite.Core/Impl/PlatformTarget.cs @@ -23,13 +23,15 @@ namespace Apache.Ignite.Core.Impl using System.Diagnostics.CodeAnalysis; using System.IO; using System.Threading.Tasks; + using Apache.Ignite.Core.Binary; + using Apache.Ignite.Core.Impl.Binary; + using Apache.Ignite.Core.Impl.Binary.IO; + using Apache.Ignite.Core.Impl.Binary.Metadata; using Apache.Ignite.Core.Impl.Common; using Apache.Ignite.Core.Impl.Memory; - using Apache.Ignite.Core.Impl.Portable; - using Apache.Ignite.Core.Impl.Portable.IO; - using Apache.Ignite.Core.Impl.Portable.Metadata; using Apache.Ignite.Core.Impl.Unmanaged; - using Apache.Ignite.Core.Portable; + using BinaryReader = Apache.Ignite.Core.Impl.Binary.BinaryReader; + using BinaryWriter = Apache.Ignite.Core.Impl.Binary.BinaryWriter; using UU = Apache.Ignite.Core.Impl.Unmanaged.UnmanagedUtils; /// <summary> @@ -65,14 +67,14 @@ namespace Apache.Ignite.Core.Impl private readonly IUnmanagedTarget _target; /** Marshaller. */ - private readonly PortableMarshaller _marsh; + private readonly Marshaller _marsh; /// <summary> /// Constructor. /// </summary> /// <param name="target">Target.</param> /// <param name="marsh">Marshaller.</param> - protected PlatformTarget(IUnmanagedTarget target, PortableMarshaller marsh) + protected PlatformTarget(IUnmanagedTarget target, Marshaller marsh) { Debug.Assert(target != null); Debug.Assert(marsh != null); @@ -92,7 +94,7 @@ namespace Apache.Ignite.Core.Impl /// <summary> /// Marshaller. /// </summary> - internal PortableMarshaller Marshaller + internal Marshaller Marshaller { get { return _marsh; } } @@ -102,10 +104,10 @@ namespace Apache.Ignite.Core.Impl /// <summary> /// Write collection. /// </summary> - /// <param name="writer">Portable writer.</param> + /// <param name="writer">Writer.</param> /// <param name="vals">Values.</param> /// <returns>The same writer for chaining.</returns> - protected static PortableWriterImpl WriteCollection<T>(PortableWriterImpl writer, ICollection<T> vals) + protected static BinaryWriter WriteCollection<T>(BinaryWriter writer, ICollection<T> vals) { return WriteCollection<T, T>(writer, vals, null); } @@ -113,10 +115,10 @@ namespace Apache.Ignite.Core.Impl /// <summary> /// Write nullable collection. /// </summary> - /// <param name="writer">Portable writer.</param> + /// <param name="writer">Writer.</param> /// <param name="vals">Values.</param> /// <returns>The same writer for chaining.</returns> - protected static PortableWriterImpl WriteNullableCollection<T>(PortableWriterImpl writer, ICollection<T> vals) + protected static BinaryWriter WriteNullableCollection<T>(BinaryWriter writer, ICollection<T> vals) { return WriteNullable(writer, vals, WriteCollection); } @@ -124,11 +126,11 @@ namespace Apache.Ignite.Core.Impl /// <summary> /// Write collection. /// </summary> - /// <param name="writer">Portable writer.</param> + /// <param name="writer">Writer.</param> /// <param name="vals">Values.</param> /// <param name="selector">A transform function to apply to each element.</param> /// <returns>The same writer for chaining.</returns> - protected static PortableWriterImpl WriteCollection<T1, T2>(PortableWriterImpl writer, + protected static BinaryWriter WriteCollection<T1, T2>(BinaryWriter writer, ICollection<T1> vals, Func<T1, T2> selector) { writer.WriteInt(vals.Count); @@ -150,10 +152,10 @@ namespace Apache.Ignite.Core.Impl /// <summary> /// Write enumerable. /// </summary> - /// <param name="writer">Portable writer.</param> + /// <param name="writer">Writer.</param> /// <param name="vals">Values.</param> /// <returns>The same writer for chaining.</returns> - protected static PortableWriterImpl WriteEnumerable<T>(PortableWriterImpl writer, IEnumerable<T> vals) + protected static BinaryWriter WriteEnumerable<T>(BinaryWriter writer, IEnumerable<T> vals) { return WriteEnumerable<T, T>(writer, vals, null); } @@ -161,11 +163,11 @@ namespace Apache.Ignite.Core.Impl /// <summary> /// Write enumerable. /// </summary> - /// <param name="writer">Portable writer.</param> + /// <param name="writer">Writer.</param> /// <param name="vals">Values.</param> /// <param name="selector">A transform function to apply to each element.</param> /// <returns>The same writer for chaining.</returns> - protected static PortableWriterImpl WriteEnumerable<T1, T2>(PortableWriterImpl writer, + protected static BinaryWriter WriteEnumerable<T1, T2>(BinaryWriter writer, IEnumerable<T1> vals, Func<T1, T2> selector) { var col = vals as ICollection<T1>; @@ -208,10 +210,10 @@ namespace Apache.Ignite.Core.Impl /// <summary> /// Write dictionary. /// </summary> - /// <param name="writer">Portable writer.</param> + /// <param name="writer">Writer.</param> /// <param name="vals">Values.</param> /// <returns>The same writer.</returns> - protected static PortableWriterImpl WriteDictionary<T1, T2>(PortableWriterImpl writer, + protected static BinaryWriter WriteDictionary<T1, T2>(BinaryWriter writer, IDictionary<T1, T2> vals) { writer.WriteInt(vals.Count); @@ -228,12 +230,12 @@ namespace Apache.Ignite.Core.Impl /// <summary> /// Write a nullable item. /// </summary> - /// <param name="writer">Portable writer.</param> + /// <param name="writer">Writer.</param> /// <param name="item">Item.</param> /// <param name="writeItem">Write action to perform on item when it is not null.</param> /// <returns>The same writer for chaining.</returns> - protected static PortableWriterImpl WriteNullable<T>(PortableWriterImpl writer, T item, - Func<PortableWriterImpl, T, PortableWriterImpl> writeItem) + protected static BinaryWriter WriteNullable<T>(BinaryWriter writer, T item, + Func<BinaryWriter, T, BinaryWriter> writeItem) { if (item == null) { @@ -257,7 +259,7 @@ namespace Apache.Ignite.Core.Impl /// <param name="type">Operation type.</param> /// <param name="action">Action to be performed on the stream.</param> /// <returns></returns> - protected long DoOutOp(int type, Action<IPortableStream> action) + protected long DoOutOp(int type, Action<IBinaryStream> action) { using (var stream = IgniteManager.Memory.Allocate().GetStream()) { @@ -273,7 +275,7 @@ namespace Apache.Ignite.Core.Impl /// <param name="type">Operation type.</param> /// <param name="action">Action to be performed on the stream.</param> /// <returns></returns> - protected long DoOutOp(int type, Action<PortableWriterImpl> action) + protected long DoOutOp(int type, Action<BinaryWriter> action) { using (var stream = IgniteManager.Memory.Allocate().GetStream()) { @@ -344,7 +346,7 @@ namespace Apache.Ignite.Core.Impl /// </summary> /// <param name="type">Type.</param> /// <param name="action">Action.</param> - protected void DoInOp(int type, Action<IPortableStream> action) + protected void DoInOp(int type, Action<IBinaryStream> action) { using (var stream = IgniteManager.Memory.Allocate().GetStream()) { @@ -362,7 +364,7 @@ namespace Apache.Ignite.Core.Impl /// <param name="type">Type.</param> /// <param name="action">Action.</param> /// <returns>Result.</returns> - protected T DoInOp<T>(int type, Func<IPortableStream, T> action) + protected T DoInOp<T>(int type, Func<IBinaryStream, T> action) { using (var stream = IgniteManager.Memory.Allocate().GetStream()) { @@ -401,13 +403,13 @@ namespace Apache.Ignite.Core.Impl /// <param name="type">Operation type.</param> /// <param name="outAction">Out action.</param> /// <param name="inAction">In action.</param> - protected void DoOutInOp(int type, Action<PortableWriterImpl> outAction, Action<IPortableStream> inAction) + protected void DoOutInOp(int type, Action<BinaryWriter> outAction, Action<IBinaryStream> inAction) { using (PlatformMemoryStream outStream = IgniteManager.Memory.Allocate().GetStream()) { using (PlatformMemoryStream inStream = IgniteManager.Memory.Allocate().GetStream()) { - PortableWriterImpl writer = _marsh.StartMarshal(outStream); + BinaryWriter writer = _marsh.StartMarshal(outStream); outAction(writer); @@ -429,13 +431,13 @@ namespace Apache.Ignite.Core.Impl /// <param name="outAction">Out action.</param> /// <param name="inAction">In action.</param> /// <returns>Result.</returns> - protected TR DoOutInOp<TR>(int type, Action<PortableWriterImpl> outAction, Func<IPortableStream, TR> inAction) + protected TR DoOutInOp<TR>(int type, Action<BinaryWriter> outAction, Func<IBinaryStream, TR> inAction) { using (PlatformMemoryStream outStream = IgniteManager.Memory.Allocate().GetStream()) { using (PlatformMemoryStream inStream = IgniteManager.Memory.Allocate().GetStream()) { - PortableWriterImpl writer = _marsh.StartMarshal(outStream); + BinaryWriter writer = _marsh.StartMarshal(outStream); outAction(writer); @@ -458,13 +460,13 @@ namespace Apache.Ignite.Core.Impl /// <param name="inAction">In action.</param> /// <param name="arg">Argument.</param> /// <returns>Result.</returns> - protected unsafe TR DoOutInOp<TR>(int type, Action<PortableWriterImpl> outAction, Func<IPortableStream, TR> inAction, void* arg) + protected unsafe TR DoOutInOp<TR>(int type, Action<BinaryWriter> outAction, Func<IBinaryStream, TR> inAction, void* arg) { using (PlatformMemoryStream outStream = IgniteManager.Memory.Allocate().GetStream()) { using (PlatformMemoryStream inStream = IgniteManager.Memory.Allocate().GetStream()) { - PortableWriterImpl writer = _marsh.StartMarshal(outStream); + BinaryWriter writer = _marsh.StartMarshal(outStream); outAction(writer); @@ -485,13 +487,13 @@ namespace Apache.Ignite.Core.Impl /// <param name="type">Operation type.</param> /// <param name="outAction">Out action.</param> /// <returns>Result.</returns> - protected TR DoOutInOp<TR>(int type, Action<PortableWriterImpl> outAction) + protected TR DoOutInOp<TR>(int type, Action<BinaryWriter> outAction) { using (PlatformMemoryStream outStream = IgniteManager.Memory.Allocate().GetStream()) { using (PlatformMemoryStream inStream = IgniteManager.Memory.Allocate().GetStream()) { - PortableWriterImpl writer = _marsh.StartMarshal(outStream); + BinaryWriter writer = _marsh.StartMarshal(outStream); outAction(writer); @@ -518,7 +520,7 @@ namespace Apache.Ignite.Core.Impl { using (PlatformMemoryStream inStream = IgniteManager.Memory.Allocate().GetStream()) { - PortableWriterImpl writer = _marsh.StartMarshal(outStream); + BinaryWriter writer = _marsh.StartMarshal(outStream); writer.WriteObject(val); @@ -546,7 +548,7 @@ namespace Apache.Ignite.Core.Impl { using (PlatformMemoryStream inStream = IgniteManager.Memory.Allocate().GetStream()) { - PortableWriterImpl writer = _marsh.StartMarshal(outStream); + BinaryWriter writer = _marsh.StartMarshal(outStream); writer.WriteObject(val1); writer.WriteObject(val2); @@ -569,27 +571,27 @@ namespace Apache.Ignite.Core.Impl /// <summary> /// Finish marshaling. /// </summary> - /// <param name="writer">Portable writer.</param> - internal void FinishMarshal(PortableWriterImpl writer) + /// <param name="writer">Writer.</param> + internal void FinishMarshal(BinaryWriter writer) { _marsh.FinishMarshal(writer); } /// <summary> - /// Put metadata to Grid. + /// Put binary types to Grid. /// </summary> - /// <param name="metas">Metadatas.</param> - internal void PutMetadata(IDictionary<int, IPortableMetadata> metas) + /// <param name="types">Binary types.</param> + internal void PutBinaryTypes(IDictionary<int, IBinaryType> types) { DoOutOp(OpMeta, stream => { - PortableWriterImpl metaWriter = _marsh.StartMarshal(stream); + BinaryWriter metaWriter = _marsh.StartMarshal(stream); - metaWriter.WriteInt(metas.Count); + metaWriter.WriteInt(types.Count); - foreach (var meta in metas.Values) + foreach (var meta in types.Values) { - PortableMetadataImpl meta0 = (PortableMetadataImpl)meta; + BinaryType meta0 = (BinaryType)meta; metaWriter.WriteInt(meta0.TypeId); metaWriter.WriteString(meta0.TypeName); @@ -609,7 +611,7 @@ namespace Apache.Ignite.Core.Impl _marsh.FinishMarshal(metaWriter); }); - _marsh.OnMetadataSent(metas); + _marsh.OnBinaryTypesSent(types); } /// <summary> @@ -617,7 +619,7 @@ namespace Apache.Ignite.Core.Impl /// </summary> /// <param name="stream">Stream.</param> /// <returns>Unmarshalled object.</returns> - protected virtual T Unmarshal<T>(IPortableStream stream) + protected virtual T Unmarshal<T>(IBinaryStream stream) { return _marsh.Unmarshal<T>(stream); } @@ -627,11 +629,11 @@ namespace Apache.Ignite.Core.Impl /// </summary> /// <typeparam name="T">Future result type</typeparam> /// <param name="listenAction">The listen action.</param> - /// <param name="keepPortable">Keep portable flag, only applicable to object futures. False by default.</param> + /// <param name="keepBinary">Keep binary flag, only applicable to object futures. False by default.</param> /// <param name="convertFunc">The function to read future result from stream.</param> /// <returns>Created future.</returns> - protected Future<T> GetFuture<T>(Action<long, int> listenAction, bool keepPortable = false, - Func<PortableReaderImpl, T> convertFunc = null) + protected Future<T> GetFuture<T>(Action<long, int> listenAction, bool keepBinary = false, + Func<BinaryReader, T> convertFunc = null) { var futType = FutureType.Object; @@ -642,7 +644,7 @@ namespace Apache.Ignite.Core.Impl var fut = convertFunc == null && futType != FutureType.Object ? new Future<T>() - : new Future<T>(new FutureConverter<T>(_marsh, keepPortable, convertFunc)); + : new Future<T>(new FutureConverter<T>(_marsh, keepBinary, convertFunc)); var futHnd = _marsh.Ignite.HandleRegistry.Allocate(fut); @@ -683,7 +685,7 @@ namespace Apache.Ignite.Core.Impl /// </summary> /// <param name="target">Target.</param> /// <param name="marsh">Marshaller.</param> - protected PlatformDisposableTarget(IUnmanagedTarget target, PortableMarshaller marsh) : base(target, marsh) + protected PlatformDisposableTarget(IUnmanagedTarget target, Marshaller marsh) : base(target, marsh) { // No-op. } http://git-wip-us.apache.org/repos/asf/ignite/blob/894057e5/modules/platforms/dotnet/Apache.Ignite.Core/Impl/Portable/DateTimeHolder.cs ---------------------------------------------------------------------- diff --git a/modules/platforms/dotnet/Apache.Ignite.Core/Impl/Portable/DateTimeHolder.cs b/modules/platforms/dotnet/Apache.Ignite.Core/Impl/Portable/DateTimeHolder.cs deleted file mode 100644 index 9c232a0..0000000 --- a/modules/platforms/dotnet/Apache.Ignite.Core/Impl/Portable/DateTimeHolder.cs +++ /dev/null @@ -1,68 +0,0 @@ -/* - * Licensed to the Apache Software Foundation (ASF) under one or more - * contributor license agreements. See the NOTICE file distributed with - * this work for additional information regarding copyright ownership. - * The ASF licenses this file to You under the Apache License, Version 2.0 - * (the "License"); you may not use this file except in compliance with - * the License. You may obtain a copy of the License at - * - * http://www.apache.org/licenses/LICENSE-2.0 - * - * Unless required by applicable law or agreed to in writing, software - * distributed under the License is distributed on an "AS IS" BASIS, - * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. - * See the License for the specific language governing permissions and - * limitations under the License. - */ - -namespace Apache.Ignite.Core.Impl.Portable -{ - using System; - using System.Diagnostics; - using Apache.Ignite.Core.Portable; - - /// <summary> - /// Wraps Serializable item in a portable. - /// </summary> - internal class DateTimeHolder : IPortableWriteAware - { - /** */ - private readonly DateTime _item; - - /// <summary> - /// Constructor. - /// </summary> - /// <param name="item">The item to wrap.</param> - public DateTimeHolder(DateTime item) - { - _item = item; - } - - /// <summary> - /// Constructor. - /// </summary> - /// <param name="reader">The reader.</param> - public DateTimeHolder(IPortableReader reader) - { - Debug.Assert(reader != null); - - _item = DateTime.FromBinary(reader.GetRawReader().ReadLong()); - } - - /// <summary> - /// Gets the item to wrap. - /// </summary> - public DateTime Item - { - get { return _item; } - } - - /** <inheritDoc /> */ - public void WritePortable(IPortableWriter writer) - { - Debug.Assert(writer != null); - - writer.GetRawWriter().WriteLong(_item.ToBinary()); - } - } -} \ No newline at end of file http://git-wip-us.apache.org/repos/asf/ignite/blob/894057e5/modules/platforms/dotnet/Apache.Ignite.Core/Impl/Portable/IPortableSystemTypeSerializer.cs ---------------------------------------------------------------------- diff --git a/modules/platforms/dotnet/Apache.Ignite.Core/Impl/Portable/IPortableSystemTypeSerializer.cs b/modules/platforms/dotnet/Apache.Ignite.Core/Impl/Portable/IPortableSystemTypeSerializer.cs deleted file mode 100644 index 3fee3ca..0000000 --- a/modules/platforms/dotnet/Apache.Ignite.Core/Impl/Portable/IPortableSystemTypeSerializer.cs +++ /dev/null @@ -1,34 +0,0 @@ -/* - * Licensed to the Apache Software Foundation (ASF) under one or more - * contributor license agreements. See the NOTICE file distributed with - * this work for additional information regarding copyright ownership. - * The ASF licenses this file to You under the Apache License, Version 2.0 - * (the "License"); you may not use this file except in compliance with - * the License. You may obtain a copy of the License at - * - * http://www.apache.org/licenses/LICENSE-2.0 - * - * Unless required by applicable law or agreed to in writing, software - * distributed under the License is distributed on an "AS IS" BASIS, - * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. - * See the License for the specific language governing permissions and - * limitations under the License. - */ - -namespace Apache.Ignite.Core.Impl.Portable -{ - using Apache.Ignite.Core.Portable; - - /// <summary> - /// Serializer for system types that can create instances directly from a stream and does not support handles. - /// </summary> - internal interface IPortableSystemTypeSerializer : IPortableSerializer - { - /// <summary> - /// Reads the instance from a reader. - /// </summary> - /// <param name="reader">The reader.</param> - /// <returns>Deserialized instance.</returns> - object ReadInstance(PortableReaderImpl reader); - } -} \ No newline at end of file http://git-wip-us.apache.org/repos/asf/ignite/blob/894057e5/modules/platforms/dotnet/Apache.Ignite.Core/Impl/Portable/IPortableTypeDescriptor.cs ---------------------------------------------------------------------- diff --git a/modules/platforms/dotnet/Apache.Ignite.Core/Impl/Portable/IPortableTypeDescriptor.cs b/modules/platforms/dotnet/Apache.Ignite.Core/Impl/Portable/IPortableTypeDescriptor.cs deleted file mode 100644 index 7e417ce..0000000 --- a/modules/platforms/dotnet/Apache.Ignite.Core/Impl/Portable/IPortableTypeDescriptor.cs +++ /dev/null @@ -1,134 +0,0 @@ -/* - * Licensed to the Apache Software Foundation (ASF) under one or more - * contributor license agreements. See the NOTICE file distributed with - * this work for additional information regarding copyright ownership. - * The ASF licenses this file to You under the Apache License, Version 2.0 - * (the "License"); you may not use this file except in compliance with - * the License. You may obtain a copy of the License at - * - * http://www.apache.org/licenses/LICENSE-2.0 - * - * Unless required by applicable law or agreed to in writing, software - * distributed under the License is distributed on an "AS IS" BASIS, - * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. - * See the License for the specific language governing permissions and - * limitations under the License. - */ - -namespace Apache.Ignite.Core.Impl.Portable -{ - using System; - using System.Collections.Generic; - - using Apache.Ignite.Core.Impl.Portable.Structure; - using Apache.Ignite.Core.Portable; - - /// <summary> - /// Type descriptor. - /// </summary> - internal interface IPortableTypeDescriptor - { - /// <summary> - /// Type. - /// </summary> - Type Type - { - get; - } - - /// <summary> - /// Type ID. - /// </summary> - int TypeId - { - get; - } - - /// <summary> - /// Type name. - /// </summary> - string TypeName - { - get; - } - - /// <summary> - /// User type flag. - /// </summary> - bool UserType - { - get; - } - - /// <summary> - /// Whether to cache deserialized value in IPortableObject - /// </summary> - bool KeepDeserialized - { - get; - } - - /// <summary> - /// Name converter. - /// </summary> - IPortableNameMapper NameMapper - { - get; - } - - /// <summary> - /// Mapper. - /// </summary> - IPortableIdMapper IdMapper - { - get; - } - - /// <summary> - /// Serializer. - /// </summary> - IPortableSerializer Serializer - { - get; - } - - /// <summary> - /// Affinity key field name. - /// </summary> - string AffinityKeyFieldName - { - get; - } - - /// <summary> - /// Write type structure. - /// </summary> - PortableStructure WriterTypeStructure { get; } - - /// <summary> - /// Read type structure. - /// </summary> - PortableStructure ReaderTypeStructure { get; } - - /// <summary> - /// Update write type structure. - /// </summary> - /// <param name="exp">Expected type structure.</param> - /// <param name="pathIdx">Path index.</param> - /// <param name="updates">Recorded updates.</param> - void UpdateWriteStructure(PortableStructure exp, int pathIdx, IList<PortableStructureUpdate> updates); - - /// <summary> - /// Update read type structure. - /// </summary> - /// <param name="exp">Expected type structure.</param> - /// <param name="pathIdx">Path index.</param> - /// <param name="updates">Recorded updates.</param> - void UpdateReadStructure(PortableStructure exp, int pathIdx, IList<PortableStructureUpdate> updates); - - /// <summary> - /// Gets the schema. - /// </summary> - PortableObjectSchema Schema { get; } - } -} http://git-wip-us.apache.org/repos/asf/ignite/blob/894057e5/modules/platforms/dotnet/Apache.Ignite.Core/Impl/Portable/IPortableWriteAware.cs ---------------------------------------------------------------------- diff --git a/modules/platforms/dotnet/Apache.Ignite.Core/Impl/Portable/IPortableWriteAware.cs b/modules/platforms/dotnet/Apache.Ignite.Core/Impl/Portable/IPortableWriteAware.cs deleted file mode 100644 index d3c1521..0000000 --- a/modules/platforms/dotnet/Apache.Ignite.Core/Impl/Portable/IPortableWriteAware.cs +++ /dev/null @@ -1,34 +0,0 @@ -/* - * Licensed to the Apache Software Foundation (ASF) under one or more - * contributor license agreements. See the NOTICE file distributed with - * this work for additional information regarding copyright ownership. - * The ASF licenses this file to You under the Apache License, Version 2.0 - * (the "License"); you may not use this file except in compliance with - * the License. You may obtain a copy of the License at - * - * http://www.apache.org/licenses/LICENSE-2.0 - * - * Unless required by applicable law or agreed to in writing, software - * distributed under the License is distributed on an "AS IS" BASIS, - * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. - * See the License for the specific language governing permissions and - * limitations under the License. - */ - -namespace Apache.Ignite.Core.Impl.Portable -{ - using Apache.Ignite.Core.Portable; - - /// <summary> - /// Represents an object that can write itself to a portable writer. - /// </summary> - internal interface IPortableWriteAware - { - /// <summary> - /// Writes this object to the given writer. - /// </summary> - /// <param name="writer">Writer.</param> - /// <exception cref="System.IO.IOException">If write failed.</exception> - void WritePortable(IPortableWriter writer); - } -} \ No newline at end of file http://git-wip-us.apache.org/repos/asf/ignite/blob/894057e5/modules/platforms/dotnet/Apache.Ignite.Core/Impl/Portable/Io/IPortableStream.cs ---------------------------------------------------------------------- diff --git a/modules/platforms/dotnet/Apache.Ignite.Core/Impl/Portable/Io/IPortableStream.cs b/modules/platforms/dotnet/Apache.Ignite.Core/Impl/Portable/Io/IPortableStream.cs deleted file mode 100644 index 80087e4..0000000 --- a/modules/platforms/dotnet/Apache.Ignite.Core/Impl/Portable/Io/IPortableStream.cs +++ /dev/null @@ -1,322 +0,0 @@ -/* - * Licensed to the Apache Software Foundation (ASF) under one or more - * contributor license agreements. See the NOTICE file distributed with - * this work for additional information regarding copyright ownership. - * The ASF licenses this file to You under the Apache License, Version 2.0 - * (the "License"); you may not use this file except in compliance with - * the License. You may obtain a copy of the License at - * - * http://www.apache.org/licenses/LICENSE-2.0 - * - * Unless required by applicable law or agreed to in writing, software - * distributed under the License is distributed on an "AS IS" BASIS, - * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. - * See the License for the specific language governing permissions and - * limitations under the License. - */ - - -namespace Apache.Ignite.Core.Impl.Portable.IO -{ - using System; - using System.Diagnostics.CodeAnalysis; - using System.IO; - using System.Text; - - /// <summary> - /// Stream capable of working with portable objects. - /// </summary> - [CLSCompliant(false)] - [SuppressMessage("Microsoft.Naming", "CA1711:IdentifiersShouldNotHaveIncorrectSuffix")] - public unsafe interface IPortableStream : IDisposable - { - /// <summary> - /// Write bool. - /// </summary> - /// <param name="val">Bool value.</param> - void WriteBool(bool val); - - /// <summary> - /// Read bool. - /// </summary> - /// <returns>Bool value.</returns> - bool ReadBool(); - - /// <summary> - /// Write bool array. - /// </summary> - /// <param name="val">Bool array.</param> - void WriteBoolArray(bool[] val); - - /// <summary> - /// Read bool array. - /// </summary> - /// <param name="cnt">Count.</param> - /// <returns>Bool array.</returns> - bool[] ReadBoolArray(int cnt); - - /// <summary> - /// Write byte. - /// </summary> - /// <param name="val">Byte value.</param> - void WriteByte(byte val); - - /// <summary> - /// Read byte. - /// </summary> - /// <returns>Byte value.</returns> - byte ReadByte(); - - /// <summary> - /// Write byte array. - /// </summary> - /// <param name="val">Byte array.</param> - void WriteByteArray(byte[] val); - - /// <summary> - /// Read byte array. - /// </summary> - /// <param name="cnt">Count.</param> - /// <returns>Byte array.</returns> - byte[] ReadByteArray(int cnt); - - /// <summary> - /// Write short. - /// </summary> - /// <param name="val">Short value.</param> - void WriteShort(short val); - - /// <summary> - /// Read short. - /// </summary> - /// <returns>Short value.</returns> - short ReadShort(); - - /// <summary> - /// Write short array. - /// </summary> - /// <param name="val">Short array.</param> - void WriteShortArray(short[] val); - - /// <summary> - /// Read short array. - /// </summary> - /// <param name="cnt">Count.</param> - /// <returns>Short array.</returns> - short[] ReadShortArray(int cnt); - - /// <summary> - /// Write char. - /// </summary> - /// <param name="val">Char value.</param> - void WriteChar(char val); - - /// <summary> - /// Read char. - /// </summary> - /// <returns>Char value.</returns> - char ReadChar(); - - /// <summary> - /// Write char array. - /// </summary> - /// <param name="val">Char array.</param> - void WriteCharArray(char[] val); - - /// <summary> - /// Read char array. - /// </summary> - /// <param name="cnt">Count.</param> - /// <returns>Char array.</returns> - char[] ReadCharArray(int cnt); - - /// <summary> - /// Write int. - /// </summary> - /// <param name="val">Int value.</param> - void WriteInt(int val); - - /// <summary> - /// Write int to specific position. - /// </summary> - /// <param name="writePos">Position.</param> - /// <param name="val">Value.</param> - void WriteInt(int writePos, int val); - - /// <summary> - /// Read int. - /// </summary> - /// <returns>Int value.</returns> - int ReadInt(); - - /// <summary> - /// Write int array. - /// </summary> - /// <param name="val">Int array.</param> - void WriteIntArray(int[] val); - - /// <summary> - /// Read int array. - /// </summary> - /// <param name="cnt">Count.</param> - /// <returns>Int array.</returns> - int[] ReadIntArray(int cnt); - - /// <summary> - /// Write long. - /// </summary> - /// <param name="val">Long value.</param> - void WriteLong(long val); - - /// <summary> - /// Read long. - /// </summary> - /// <returns>Long value.</returns> - long ReadLong(); - - /// <summary> - /// Write long array. - /// </summary> - /// <param name="val">Long array.</param> - void WriteLongArray(long[] val); - - /// <summary> - /// Read long array. - /// </summary> - /// <param name="cnt">Count.</param> - /// <returns>Long array.</returns> - long[] ReadLongArray(int cnt); - - /// <summary> - /// Write float. - /// </summary> - /// <param name="val">Float value.</param> - void WriteFloat(float val); - - /// <summary> - /// Read float. - /// </summary> - /// <returns>Float value.</returns> - float ReadFloat(); - - /// <summary> - /// Write float array. - /// </summary> - /// <param name="val">Float array.</param> - void WriteFloatArray(float[] val); - - /// <summary> - /// Read float array. - /// </summary> - /// <param name="cnt">Count.</param> - /// <returns>Float array.</returns> - float[] ReadFloatArray(int cnt); - - /// <summary> - /// Write double. - /// </summary> - /// <param name="val">Double value.</param> - void WriteDouble(double val); - - /// <summary> - /// Read double. - /// </summary> - /// <returns>Double value.</returns> - double ReadDouble(); - - /// <summary> - /// Write double array. - /// </summary> - /// <param name="val">Double array.</param> - void WriteDoubleArray(double[] val); - - /// <summary> - /// Read double array. - /// </summary> - /// <param name="cnt">Count.</param> - /// <returns>Double array.</returns> - double[] ReadDoubleArray(int cnt); - - /// <summary> - /// Write string. - /// </summary> - /// <param name="chars">Characters.</param> - /// <param name="charCnt">Char count.</param> - /// <param name="byteCnt">Byte count.</param> - /// <param name="encoding">Encoding.</param> - /// <returns>Amounts of bytes written.</returns> - int WriteString(char* chars, int charCnt, int byteCnt, Encoding encoding); - - /// <summary> - /// Write arbitrary data. - /// </summary> - /// <param name="src">Source array.</param> - /// <param name="off">Offset</param> - /// <param name="cnt">Count.</param> - void Write(byte[] src, int off, int cnt); - - /// <summary> - /// Read arbitrary data. - /// </summary> - /// <param name="dest">Destination array.</param> - /// <param name="off">Offset.</param> - /// <param name="cnt">Count.</param> - /// <returns>Amount of bytes read.</returns> - void Read(byte[] dest, int off, int cnt); - - /// <summary> - /// Write arbitrary data. - /// </summary> - /// <param name="src">Source.</param> - /// <param name="cnt">Count.</param> - void Write(byte* src, int cnt); - - /// <summary> - /// Read arbitrary data. - /// </summary> - /// <param name="dest">Destination.</param> - /// <param name="cnt">Count.</param> - void Read(byte* dest, int cnt); - - /// <summary> - /// Position. - /// </summary> - int Position - { - get; - } - - /// <summary> - /// Gets remaining bytes in the stream. - /// </summary> - /// <value>Remaining bytes.</value> - int Remaining { get; } - - /// <summary> - /// Gets underlying array, avoiding copying if possible. - /// </summary> - /// <returns>Underlying array.</returns> - byte[] GetArray(); - - /// <summary> - /// Gets underlying data in a new array. - /// </summary> - /// <returns>New array with data.</returns> - byte[] GetArrayCopy(); - - /// <summary> - /// Check whether array passed as argument is the same as the stream hosts. - /// </summary> - /// <param name="arr">Array.</param> - /// <returns><c>True</c> if they are same.</returns> - bool IsSameArray(byte[] arr); - - /// <summary> - /// Seek to the given positoin. - /// </summary> - /// <param name="offset">Offset.</param> - /// <param name="origin">Seek origin.</param> - /// <returns>Position.</returns> - int Seek(int offset, SeekOrigin origin); - } -}
