Skip to content

Commit

Permalink
Formatting
Browse files Browse the repository at this point in the history
  • Loading branch information
mgnsm committed Apr 18, 2023
1 parent 449db1b commit 7c3c021
Show file tree
Hide file tree
Showing 9 changed files with 53 additions and 55 deletions.
18 changes: 9 additions & 9 deletions Source/Millistream.Streaming/ConnectionStatus.cs
Original file line number Diff line number Diff line change
Expand Up @@ -5,13 +5,13 @@
/// </summary>
public enum ConnectionStatus
{
MDF_STATUS_LOOKUP,
MDF_STATUS_CONNECTING,
MDF_STATUS_CONNECTED,
MDF_STATUS_DISCONNECTED,
MDF_STATUS_READYTOLOGON,
MDF_STATUS_SND_HB_REQ,
MDF_STATUS_RCV_HB_REQ,
MDF_STATUS_RCV_HB_RES
};
MDF_STATUS_LOOKUP,
MDF_STATUS_CONNECTING,
MDF_STATUS_CONNECTED,
MDF_STATUS_DISCONNECTED,
MDF_STATUS_READYTOLOGON,
MDF_STATUS_SND_HB_REQ,
MDF_STATUS_RCV_HB_REQ,
MDF_STATUS_RCV_HB_RES
};
}
3 changes: 1 addition & 2 deletions Source/Millistream.Streaming/Interop/NativeImplementation.cs
Original file line number Diff line number Diff line change
Expand Up @@ -5,7 +5,7 @@
#endif
namespace Millistream.Streaming.Interop
{
unsafe internal sealed class NativeImplementation
internal sealed unsafe class NativeImplementation
{
private static NativeImplementation s_defaultImplementation;

Expand Down Expand Up @@ -87,7 +87,6 @@ internal NativeImplementation(string libraryPath)
else
throw new PlatformNotSupportedException();


mdf_create = (delegate* unmanaged[Cdecl]<IntPtr>)nativeLibrary.GetExport(lib, nameof(mdf_create));
mdf_destroy = (delegate* unmanaged[Cdecl]<IntPtr, void>)nativeLibrary.GetExport(lib, nameof(mdf_destroy));
mdf_consume = (delegate* unmanaged[Cdecl]<IntPtr, int, int>)nativeLibrary.GetExport(lib, nameof(mdf_consume));
Expand Down
2 changes: 1 addition & 1 deletion Source/Millistream.Streaming/Interop/NativeUnixLibrary.cs
Original file line number Diff line number Diff line change
Expand Up @@ -17,7 +17,7 @@ internal sealed class NativeUnixLibrary : NativeLibrary
protected override IntPtr DoGetExport(IntPtr handle, string name) =>
dlsym(handle, name);

protected override IntPtr DoLoad(string libraryPath) =>
protected override IntPtr DoLoad(string libraryPath) =>
dlopen(libraryPath, RTLD_NOW);
}
}
46 changes: 23 additions & 23 deletions Source/Millistream.Streaming/MDF_OPTION.cs
Original file line number Diff line number Diff line change
Expand Up @@ -2,27 +2,27 @@
{
internal enum MDF_OPTION
{
MDF_OPT_FD,
MDF_OPT_ERROR,
MDF_OPT_RCV_BYTES,
MDF_OPT_SENT_BYTES,
MDF_OPT_DATA_CALLBACK_FUNCTION,
MDF_OPT_DATA_CALLBACK_USERDATA,
MDF_OPT_STATUS_CALLBACK_FUNCTION,
MDF_OPT_STATUS_CALLBACK_USERDATA,
MDF_OPT_CONNECT_TIMEOUT,
MDF_OPT_HEARTBEAT_INTERVAL,
MDF_OPT_HEARTBEAT_MAX_MISSED,
MDF_OPT_TCP_NODELAY,
MDF_OPT_NO_ENCRYPTION,
MDF_OPT_TIME_DIFFERENCE,
MDF_OPT_BIND_ADDRESS,
MDF_OPT_TIME_DIFFERENCE_NS,
MDF_OPT_CRYPT_DIGESTS,
MDF_OPT_CRYPT_CIPHERS,
MDF_OPT_CRYPT_DIGEST,
MDF_OPT_CRYPT_CIPHER,
MDF_OPT_TIMEOUT,
MDF_OPT_HANDLE_DELAY
};
MDF_OPT_FD,
MDF_OPT_ERROR,
MDF_OPT_RCV_BYTES,
MDF_OPT_SENT_BYTES,
MDF_OPT_DATA_CALLBACK_FUNCTION,
MDF_OPT_DATA_CALLBACK_USERDATA,
MDF_OPT_STATUS_CALLBACK_FUNCTION,
MDF_OPT_STATUS_CALLBACK_USERDATA,
MDF_OPT_CONNECT_TIMEOUT,
MDF_OPT_HEARTBEAT_INTERVAL,
MDF_OPT_HEARTBEAT_MAX_MISSED,
MDF_OPT_TCP_NODELAY,
MDF_OPT_NO_ENCRYPTION,
MDF_OPT_TIME_DIFFERENCE,
MDF_OPT_BIND_ADDRESS,
MDF_OPT_TIME_DIFFERENCE_NS,
MDF_OPT_CRYPT_DIGESTS,
MDF_OPT_CRYPT_CIPHERS,
MDF_OPT_CRYPT_DIGEST,
MDF_OPT_CRYPT_CIPHER,
MDF_OPT_TIMEOUT,
MDF_OPT_HANDLE_DELAY
};
}
8 changes: 4 additions & 4 deletions Source/Millistream.Streaming/MarketDataFeed.cs
Original file line number Diff line number Diff line change
Expand Up @@ -14,7 +14,7 @@ namespace Millistream.Streaming
/// <typeparam name="TCallbackUserData">The type of the custom user data that will be available to the data callback function.</typeparam>
/// <typeparam name="TStatusCallbackUserData">The type of the custom user data that will be available to the status callback function.</typeparam>
/// <remarks>Handles are not thread-safe. If multiple threads will share access to a single handle, the accesses has to be serialized using a mutex or other forms of locking mechanisms. The API as such is thread-safe so multiple threads can have local handles without the need for locks.</remarks>
public unsafe sealed class MarketDataFeed<TCallbackUserData, TStatusCallbackUserData> : IMarketDataFeed<TCallbackUserData, TStatusCallbackUserData>, IDisposable
public sealed unsafe class MarketDataFeed<TCallbackUserData, TStatusCallbackUserData> : IMarketDataFeed<TCallbackUserData, TStatusCallbackUserData>, IDisposable
{
#region Constants
internal const int MinConnectionTimeout = 1;
Expand Down Expand Up @@ -54,7 +54,7 @@ public MarketDataFeed()
/// <exception cref="ArgumentNullException"><paramref name="nativeLibraryPath"/> is <see langword="null" /> or <see cref="string.Empty"/>.</exception>
/// <exception cref="DllNotFoundException">The native dependency can't be found.</exception>
/// <remarks>The corresponding native function is mdf_create.</remarks>
public MarketDataFeed(string nativeLibraryPath)
public MarketDataFeed(string nativeLibraryPath)
: this(nativeLibraryPath, true) { }

internal MarketDataFeed(NativeImplementation nativeImplementation)
Expand Down Expand Up @@ -486,7 +486,7 @@ public bool GetNextField(out Field field, out ReadOnlySpan<byte> value)
/// <returns><see langword="true" /> if a connection has been set up or <see langword="false" /> if a connection attempt failed with every server on the list.</returns>
/// <remarks>The corresponding native function is mdf_connect.</remarks>
[MethodImpl(MethodImplOptions.AggressiveInlining)]
public bool Connect(string servers) => !string.IsNullOrEmpty(servers)
public bool Connect(string servers) => !string.IsNullOrEmpty(servers)
&& _nativeImplementation.mdf_connect(_feedHandle, servers) == 1;

/// <summary>
Expand Down Expand Up @@ -580,7 +580,7 @@ private string GetStringProperty(MDF_OPTION option)
{
fixed (char* c = chars)
{
Encoding.UTF8.GetChars(p, byteCount, c, charCount);
_ = Encoding.UTF8.GetChars(p, byteCount, c, charCount);
return new string(c);
}
}
Expand Down
7 changes: 3 additions & 4 deletions Source/Millistream.Streaming/Message.ByteOverloads.cs
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,7 @@

namespace Millistream.Streaming
{
public unsafe sealed partial class Message
public sealed unsafe partial class Message
{
/// <summary>
/// Adds a numeric field to the current active message.
Expand Down Expand Up @@ -53,7 +53,7 @@ public bool AddString(uint tag, ReadOnlySpan<byte> value)
/// <remarks>The corresponding native function is mdf_message_add_string2.</remarks>
public bool AddString(uint tag, ReadOnlySpan<byte> value, int length)
{
if (_nativeImplementation.mdf_message_add_string2 == default || (value != null && length < 0))
if (_nativeImplementation.mdf_message_add_string2 == default || value != null && length < 0)
return false;

fixed (byte* bytes = value)
Expand Down Expand Up @@ -161,7 +161,6 @@ public bool AddList(uint tag, ReadOnlySpan<byte> value)
public bool AddList(Field tag, ReadOnlySpan<byte> value) =>
AddList((uint)tag, value);


/// <summary>
/// Deserializes a base64 encoded message chain and replaces the existing (if any) message chain in the message handle.
/// </summary>
Expand All @@ -171,7 +170,7 @@ public bool AddList(Field tag, ReadOnlySpan<byte> value) =>
public bool Deserialize(ReadOnlySpan<byte> data)
{
fixed (byte* bytes = data)
return _nativeImplementation.mdf_message_deserialize != default
return _nativeImplementation.mdf_message_deserialize != default
&& _nativeImplementation.mdf_message_deserialize(Handle, (IntPtr)bytes) == 1;
}
}
Expand Down
18 changes: 9 additions & 9 deletions Source/Millistream.Streaming/Message.cs
Original file line number Diff line number Diff line change
Expand Up @@ -10,7 +10,7 @@ namespace Millistream.Streaming
/// Represents a managed message handle (mdf_message_t) that can contain several messages for efficiency.
/// </summary>
/// <remarks>Handles are not thread-safe. If multiple threads will share access to a single handle, the accesses has to be serialized using a mutex or other forms of locking mechanisms. The API as such is thread-safe so multiple threads can have local handles without the need for locks.</remarks>
public unsafe sealed partial class Message : IMessage, IDisposable
public sealed unsafe partial class Message : IMessage, IDisposable
{
private readonly NativeImplementation _nativeImplementation;
private CompressionLevel _compressionLevel = CompressionLevel.Z_BEST_SPEED;
Expand Down Expand Up @@ -90,7 +90,7 @@ public CompressionLevel CompressionLevel
/// Gets the number of added fields to the current message.
/// </summary>
/// <remarks>The corresponding native function is mdf_message_get_num_fields.</remarks>
public int FieldCount => _nativeImplementation.mdf_message_get_num_fields != default ?
public int FieldCount => _nativeImplementation.mdf_message_get_num_fields != default ?
_nativeImplementation.mdf_message_get_num_fields(_handle) : default;

/// <summary>
Expand Down Expand Up @@ -124,7 +124,7 @@ public byte Delay
get => _delay;
set
{
if (_nativeImplementation.mdf_message_set_property != default
if (_nativeImplementation.mdf_message_set_property != default
&& _nativeImplementation.mdf_message_set_property(_handle, MDF_MSG_OPTION.MDF_MSG_OPT_DELAY, value) == 1)
_delay = value;
}
Expand Down Expand Up @@ -187,7 +187,7 @@ public bool AddNumeric(Field tag, string value) =>
/// <returns><see langword = "true" /> if the field was successfully added, or <see langword="false" /> if the value could not be added (because there was no more memory, the message handle does not contain any messages, or the supplied value is not of the type specified).</returns>
/// <remarks>The corresponding native function is mdf_message_add_int.</remarks>
[MethodImpl(MethodImplOptions.AggressiveInlining)]
public bool AddInt64(uint tag, long value, int decimals) =>
public bool AddInt64(uint tag, long value, int decimals) =>
_nativeImplementation.mdf_message_add_int != default && _nativeImplementation.mdf_message_add_int(_handle, tag, value, decimals) == 1;

/// <summary>
Expand Down Expand Up @@ -281,7 +281,7 @@ public bool AddString(uint tag, string value, int length)
{
fixed (byte* b = bytes)
{
Encoding.UTF8.GetBytes(c, length, b, byteCount);
_ = Encoding.UTF8.GetBytes(c, length, b, byteCount);
return _nativeImplementation.mdf_message_add_string2(_handle, tag, (IntPtr)b, byteCount) == 1;
}
}
Expand Down Expand Up @@ -447,7 +447,7 @@ public bool AddTime3(Field tag, int hour, int minute, int second, int nanosecond
/// <returns><see langword="true" /> if the field was successfully added, or <see langword="false" /> if the value could not be added (because there was no more memory, the message handle does not contain any messages, or the supplied value is not of the type specified).</returns>
/// <remarks>The corresponding native function is mdf_message_add_list.</remarks>
[MethodImpl(MethodImplOptions.AggressiveInlining)]
public bool AddList(uint tag, string value) =>
public bool AddList(uint tag, string value) =>
_nativeImplementation.mdf_message_add_list_str(_handle, tag, value) == 1;

/// <summary>
Expand Down Expand Up @@ -503,7 +503,7 @@ public static bool Move(Message source, Message destination, ulong sourceInsref,
public bool Serialize(out IntPtr result)
{
result = IntPtr.Zero;
return _nativeImplementation.mdf_message_serialize != default
return _nativeImplementation.mdf_message_serialize != default
&& _nativeImplementation.mdf_message_serialize(_handle, ref result) == 1;
}

Expand All @@ -514,7 +514,7 @@ public bool Serialize(out IntPtr result)
/// <returns><see langword="true" /> if the message chain was successfully deserialized, or <see langword="false" /> if the deserialization failed (if so the current message chain in the message handler is left untouched).</returns>
/// <remarks>The corresponding native function is mdf_message_deserialize.</remarks>
[MethodImpl(MethodImplOptions.AggressiveInlining)]
public bool Deserialize(string data) => !string.IsNullOrEmpty(data)
public bool Deserialize(string data) => !string.IsNullOrEmpty(data)
&& _nativeImplementation.mdf_message_deserialize_str != default
&& _nativeImplementation.mdf_message_deserialize_str(_handle, data) == 1;

Expand All @@ -525,7 +525,7 @@ public bool Deserialize(string data) => !string.IsNullOrEmpty(data)
/// <returns><see langword="true" /> if the message chain was successfully deserialized, or <see langword="false" /> if the deserialization failed (if so the current message chain in the message handler is left untouched).</returns>
/// <remarks>The corresponding native function is mdf_message_deserialize.</remarks>
[MethodImpl(MethodImplOptions.AggressiveInlining)]
public bool Deserialize(IntPtr data) => _nativeImplementation.mdf_message_deserialize != default
public bool Deserialize(IntPtr data) => _nativeImplementation.mdf_message_deserialize != default
&& _nativeImplementation.mdf_message_deserialize(_handle, data) == 1;

/// <summary>
Expand Down
2 changes: 1 addition & 1 deletion Source/Millistream.Streaming/MessageClasses.cs
Original file line number Diff line number Diff line change
Expand Up @@ -8,7 +8,7 @@ namespace Millistream.Streaming
[Flags]
public enum MessageClasses : uint
{
MDF_MC_UNDEF,
MDF_MC_UNDEF,
MDF_MC_NEWSHEADLINE,
MDF_MC_QUOTE,
MDF_MC_TRADE = 4,
Expand Down
4 changes: 2 additions & 2 deletions Source/Millistream.Streaming/StringConstants.cs
Original file line number Diff line number Diff line change
Expand Up @@ -17,7 +17,7 @@ public static class RequestClasses
public const string MDF_RC_ORDER = "3";
public const string MDF_RC_BASICDATA = "4";
public const string MDF_RC_PRICEHISTORY = "5";
public const string MDF_RC_FIELDSREFERENCE ="6";
public const string MDF_RC_FIELDSREFERENCE = "6";
public const string MDF_RC_INSREF = "7";
public const string MDF_RC_NEWSCONTENT = "8";
public const string MDF_RC_CORPORATEACTION = "9";
Expand All @@ -26,7 +26,7 @@ public static class RequestClasses
public const string MDF_RC_PERFORMANCE = "12";
public const string MDF_RC_KEYRATIOS = "13";
public const string MDF_RC_ESTIMATES = "14";
public const string MDF_RC_ESTIMATESHISTORY ="15";
public const string MDF_RC_ESTIMATESHISTORY = "15";
public const string MDF_RC_NETORDERIMBALANCE = "16";
public const string MDF_RC_L10N = "17";
public const string MDF_RC_CI = "18";
Expand Down

0 comments on commit 7c3c021

Please sign in to comment.