You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@ignite.apache.org by av...@apache.org on 2015/12/24 11:58:10 UTC
[07/50] [abbrv] ignite git commit: IGNITE-2215: .NET: Use standard
Action and Func instead of custom delegates in binary readers.
IGNITE-2215: .NET: Use standard Action and Func instead of custom delegates in binary readers.
Project: http://git-wip-us.apache.org/repos/asf/ignite/repo
Commit: http://git-wip-us.apache.org/repos/asf/ignite/commit/6edeccde
Tree: http://git-wip-us.apache.org/repos/asf/ignite/tree/6edeccde
Diff: http://git-wip-us.apache.org/repos/asf/ignite/diff/6edeccde
Branch: refs/heads/master
Commit: 6edeccde24a2897363ee905e3cc5cef10e2f47ce
Parents: d4687d9
Author: Pavel Tupitsyn <pt...@gridgain.com>
Authored: Mon Dec 21 14:58:04 2015 +0300
Committer: vozerov-gridgain <vo...@gridgain.com>
Committed: Mon Dec 21 14:58:04 2015 +0300
----------------------------------------------------------------------
.../Binary/IBinaryRawReader.cs | 4 ++--
.../Apache.Ignite.Core/Binary/IBinaryReader.cs | 25 ++------------------
.../Impl/Binary/BinaryReader.cs | 13 +++++-----
.../Impl/Binary/BinaryUtils.cs | 4 ++--
4 files changed, 12 insertions(+), 34 deletions(-)
----------------------------------------------------------------------
http://git-wip-us.apache.org/repos/asf/ignite/blob/6edeccde/modules/platforms/dotnet/Apache.Ignite.Core/Binary/IBinaryRawReader.cs
----------------------------------------------------------------------
diff --git a/modules/platforms/dotnet/Apache.Ignite.Core/Binary/IBinaryRawReader.cs b/modules/platforms/dotnet/Apache.Ignite.Core/Binary/IBinaryRawReader.cs
index a719e36..40ed754 100644
--- a/modules/platforms/dotnet/Apache.Ignite.Core/Binary/IBinaryRawReader.cs
+++ b/modules/platforms/dotnet/Apache.Ignite.Core/Binary/IBinaryRawReader.cs
@@ -205,7 +205,7 @@ namespace Apache.Ignite.Core.Binary
/// <param name="factory">Factory.</param>
/// <param name="adder">Adder.</param>
/// <returns>Collection.</returns>
- ICollection ReadCollection(CollectionFactory factory, CollectionAdder adder);
+ ICollection ReadCollection(Func<int, ICollection> factory, Action<ICollection, object> adder);
/// <summary>
/// Read dictionary.
@@ -218,6 +218,6 @@ namespace Apache.Ignite.Core.Binary
/// </summary>
/// <param name="factory">Factory.</param>
/// <returns>Dictionary.</returns>
- IDictionary ReadDictionary(DictionaryFactory factory);
+ IDictionary ReadDictionary(Func<int, IDictionary> factory);
}
}
http://git-wip-us.apache.org/repos/asf/ignite/blob/6edeccde/modules/platforms/dotnet/Apache.Ignite.Core/Binary/IBinaryReader.cs
----------------------------------------------------------------------
diff --git a/modules/platforms/dotnet/Apache.Ignite.Core/Binary/IBinaryReader.cs b/modules/platforms/dotnet/Apache.Ignite.Core/Binary/IBinaryReader.cs
index 2ccbbc0..4de3e92 100644
--- a/modules/platforms/dotnet/Apache.Ignite.Core/Binary/IBinaryReader.cs
+++ b/modules/platforms/dotnet/Apache.Ignite.Core/Binary/IBinaryReader.cs
@@ -21,27 +21,6 @@ namespace Apache.Ignite.Core.Binary
using System.Collections;
/// <summary>
- /// Delegate for collection creation.
- /// </summary>
- /// <param name="size">Collection size.</param>
- /// <returns>Collection.</returns>
- public delegate ICollection CollectionFactory(int size);
-
- /// <summary>
- /// Delegate for adding element to collection.
- /// </summary>
- /// <param name="col">Collection.</param>
- /// <param name="elem">Element to add.</param>
- public delegate void CollectionAdder(ICollection col, object elem);
-
- /// <summary>
- /// Delegate for dictionary creation.
- /// </summary>
- /// <param name="size">Dictionary size.</param>
- /// <returns>Dictionary.</returns>
- public delegate IDictionary DictionaryFactory(int size);
-
- /// <summary>
/// Reader for binary objects.
/// </summary>
public interface IBinaryReader
@@ -253,7 +232,7 @@ namespace Apache.Ignite.Core.Binary
/// <param name="factory">Factory.</param>
/// <param name="adder">Adder.</param>
/// <returns>Collection.</returns>
- ICollection ReadCollection(string fieldName, CollectionFactory factory, CollectionAdder adder);
+ ICollection ReadCollection(string fieldName, Func<int, ICollection> factory, Action<ICollection, object> adder);
/// <summary>
/// Read named dictionary.
@@ -268,7 +247,7 @@ namespace Apache.Ignite.Core.Binary
/// <param name="fieldName">Field name.</param>
/// <param name="factory">Factory.</param>
/// <returns>Dictionary.</returns>
- IDictionary ReadDictionary(string fieldName, DictionaryFactory factory);
+ IDictionary ReadDictionary(string fieldName, Func<int, IDictionary> factory);
/// <summary>
/// Get raw reader.
http://git-wip-us.apache.org/repos/asf/ignite/blob/6edeccde/modules/platforms/dotnet/Apache.Ignite.Core/Impl/Binary/BinaryReader.cs
----------------------------------------------------------------------
diff --git a/modules/platforms/dotnet/Apache.Ignite.Core/Impl/Binary/BinaryReader.cs b/modules/platforms/dotnet/Apache.Ignite.Core/Impl/Binary/BinaryReader.cs
index 7b887a9..105589a 100644
--- a/modules/platforms/dotnet/Apache.Ignite.Core/Impl/Binary/BinaryReader.cs
+++ b/modules/platforms/dotnet/Apache.Ignite.Core/Impl/Binary/BinaryReader.cs
@@ -484,15 +484,14 @@ namespace Apache.Ignite.Core.Impl.Binary
}
/** <inheritdoc /> */
- public ICollection ReadCollection(string fieldName, CollectionFactory factory,
- CollectionAdder adder)
+ public ICollection ReadCollection(string fieldName, Func<int, ICollection> factory,
+ Action<ICollection, object> adder)
{
return ReadField(fieldName, r => BinaryUtils.ReadCollection(r, factory, adder), BinaryUtils.TypeCollection);
}
/** <inheritdoc /> */
- public ICollection ReadCollection(CollectionFactory factory,
- CollectionAdder adder)
+ public ICollection ReadCollection(Func<int, ICollection> factory, Action<ICollection, object> adder)
{
return Read(r => BinaryUtils.ReadCollection(r, factory, adder), BinaryUtils.TypeCollection);
}
@@ -506,17 +505,17 @@ namespace Apache.Ignite.Core.Impl.Binary
/** <inheritdoc /> */
public IDictionary ReadDictionary()
{
- return ReadDictionary((DictionaryFactory)null);
+ return ReadDictionary((Func<int, IDictionary>) null);
}
/** <inheritdoc /> */
- public IDictionary ReadDictionary(string fieldName, DictionaryFactory factory)
+ public IDictionary ReadDictionary(string fieldName, Func<int, IDictionary> factory)
{
return ReadField(fieldName, r => BinaryUtils.ReadDictionary(r, factory), BinaryUtils.TypeDictionary);
}
/** <inheritdoc /> */
- public IDictionary ReadDictionary(DictionaryFactory factory)
+ public IDictionary ReadDictionary(Func<int, IDictionary> factory)
{
return Read(r => BinaryUtils.ReadDictionary(r, factory), BinaryUtils.TypeDictionary);
}
http://git-wip-us.apache.org/repos/asf/ignite/blob/6edeccde/modules/platforms/dotnet/Apache.Ignite.Core/Impl/Binary/BinaryUtils.cs
----------------------------------------------------------------------
diff --git a/modules/platforms/dotnet/Apache.Ignite.Core/Impl/Binary/BinaryUtils.cs b/modules/platforms/dotnet/Apache.Ignite.Core/Impl/Binary/BinaryUtils.cs
index 1ae5722..1c85e31 100644
--- a/modules/platforms/dotnet/Apache.Ignite.Core/Impl/Binary/BinaryUtils.cs
+++ b/modules/platforms/dotnet/Apache.Ignite.Core/Impl/Binary/BinaryUtils.cs
@@ -1104,7 +1104,7 @@ namespace Apache.Ignite.Core.Impl.Binary
* <returns>Collection.</returns>
*/
public static ICollection ReadCollection(BinaryReader ctx,
- CollectionFactory factory, CollectionAdder adder)
+ Func<int, ICollection> factory, Action<ICollection, object> adder)
{
IBinaryStream stream = ctx.Stream;
@@ -1181,7 +1181,7 @@ namespace Apache.Ignite.Core.Impl.Binary
* <param name="factory">Factory delegate.</param>
* <returns>Dictionary.</returns>
*/
- public static IDictionary ReadDictionary(BinaryReader ctx, DictionaryFactory factory)
+ public static IDictionary ReadDictionary(BinaryReader ctx, Func<int, IDictionary> factory)
{
IBinaryStream stream = ctx.Stream;