Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
24 changes: 12 additions & 12 deletions QuickFIXn/DataDictionary/DDField.cs
Original file line number Diff line number Diff line change
Expand Up @@ -13,37 +13,37 @@ public class DDField
/// <param name="name"></param>
/// <param name="enums">dictionary of enum=>description values</param>
/// <param name="fixFldType"></param>
public DDField(int tag, String name, IReadOnlyDictionary<String, String> enums, String fixFldType)
public DDField(int tag, string name, IReadOnlyDictionary<string, string> enums, string fixFldType)
{
this.Tag = tag;
this.Name = name;
this.EnumDict = enums.ToFrozenDictionary();
this.FixFldType = fixFldType;
this.FieldType = FieldTypeFromFix(this.FixFldType, out bool isMVFWE);
this.IsMultipleValueFieldWithEnums = isMVFWE;
this.FieldType = FieldTypeFromFix(this.FixFldType, out bool isMultipleValueFieldWithEnums);
this.IsMultipleValueFieldWithEnums = isMultipleValueFieldWithEnums;
}

public int Tag { get; private set; }
public String Name { get; private set; }
public string Name { get; private set; }

public IReadOnlyDictionary<String, String> EnumDict { get; }
public IReadOnlyDictionary<string, string> EnumDict { get; }

public String FixFldType { get; private set; }
public string FixFldType { get; private set; }
public Type FieldType { get; private set; }

/// <summary>
/// true if FIX field has an enum and if its type is one of: {MultipleValueString,MultipleStringValue,MultipleCharValue}
/// </summary>
public bool IsMultipleValueFieldWithEnums { get; private set; }

public Boolean HasEnums()
public bool HasEnums()
{
return EnumDict.Count > 0;
}

private Type FieldTypeFromFix(String type, out bool multipleValueFieldWithEnums)
private Type FieldTypeFromFix(string type, out bool isMultipleValueFieldWithEnums)
{
multipleValueFieldWithEnums = false;
isMultipleValueFieldWithEnums = false;

switch (type)
{
Expand All @@ -54,9 +54,9 @@ private Type FieldTypeFromFix(String type, out bool multipleValueFieldWithEnums)
case "AMT": return typeof(Fields.DecimalField);
case "QTY": return typeof(Fields.DecimalField);
case "CURRENCY": return typeof(Fields.StringField);
case "MULTIPLEVALUESTRING": multipleValueFieldWithEnums = true; return typeof(Fields.StringField);
case "MULTIPLESTRINGVALUE": multipleValueFieldWithEnums = true; return typeof(Fields.StringField);
case "MULTIPLECHARVALUE": multipleValueFieldWithEnums = true; return typeof(Fields.StringField);
case "MULTIPLEVALUESTRING": isMultipleValueFieldWithEnums = true; return typeof(Fields.StringField);
case "MULTIPLESTRINGVALUE": isMultipleValueFieldWithEnums = true; return typeof(Fields.StringField);
case "MULTIPLECHARVALUE": isMultipleValueFieldWithEnums = true; return typeof(Fields.StringField);
case "EXCHANGE": return typeof(Fields.StringField);
case "UTCTIMESTAMP": return typeof(Fields.DateTimeField);
case "BOOLEAN": return typeof(Fields.BooleanField);
Expand Down
102 changes: 50 additions & 52 deletions QuickFIXn/DataDictionary/DDMap.cs
Original file line number Diff line number Diff line change
@@ -1,68 +1,66 @@
using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;

namespace QuickFix.DataDictionary
{
/// <summary>
/// Represents the DD definition for a message type
/// </summary>
public class DDMap : IFieldMapSpec
{
public Dictionary<int, DDField> Fields = new Dictionary<int, DDField>();
public Dictionary<int, DDGrp> Groups = new Dictionary<int, DDGrp>();
public HashSet<int> ReqFields = new HashSet<int>();
namespace QuickFix.DataDictionary;

public void AddField(DDField fld)
{
Fields.Add(fld.Tag, fld);
}
/// <summary>
/// Represents the DD definition for a message type
/// </summary>
public class DDMap : IFieldMapSpec
{
public Dictionary<int, DDField> Fields = new();
public Dictionary<int, DDGrp> Groups = new();
public HashSet<int> ReqFields = [];

public void AddGroup(DDGrp grp)
{
Groups.Add(grp.Delim, grp);
}
public void AddField(DDField fld)
{
Fields.Add(fld.Tag, fld);
}

public Boolean IsGroup(int tag)
{
return Groups.ContainsKey(tag);
}
public void AddGroup(DDGrp grp)
{
Groups.Add(grp.Delim, grp);
}

public Boolean IsField(int tag)
{
return Fields.ContainsKey(tag);
}
public Boolean IsGroup(int tag)
{
return Groups.ContainsKey(tag);
}

public DDGrp GetGroup(int tag)
{
return Groups[tag];
}
public Boolean IsField(int tag)
{
return Fields.ContainsKey(tag);
}

/// <summary>
/// Same as GetGroup, just a more-general return type.
/// </summary>
/// <param name="tag"></param>
/// <returns></returns>
public IGroupSpec GetGroupSpec(int tag)
{
return Groups[tag];
}
public DDGrp GetGroup(int tag)
{
return Groups[tag];
}

/// <summary>
/// Represents the DD definition for a group type
/// Same as GetGroup, just a more-general return type.
/// </summary>
public class DDGrp : DDMap, IGroupSpec
/// <param name="tag"></param>
/// <returns></returns>
public IGroupSpec GetGroupSpec(int tag)
{
return Groups[tag];
}
}

/// <summary>
/// Represents the DD definition for a group type
/// </summary>
public class DDGrp : DDMap, IGroupSpec
{
public int NumFld { get; set; }
public int Delim { get; set; }
public Boolean Required = false;
public DDGrp() : base()
{
public int NumFld { get; set; }
public int Delim { get; set; }
public Boolean Required = false;
public DDGrp() : base()
{
Delim = 0;
NumFld = 0;
Required = false;
}
Delim = 0;
NumFld = 0;
Required = false;
}
}

17 changes: 8 additions & 9 deletions QuickFIXn/DataDictionary/DictionaryParseException.cs
Original file line number Diff line number Diff line change
@@ -1,13 +1,12 @@
using System;

namespace QuickFix
namespace QuickFix.DataDictionary;

public class DictionaryParseException : ApplicationException
{
public class DictionaryParseException : ApplicationException
{
public DictionaryParseException() { }
public DictionaryParseException(string message)
: base(message) { }
public DictionaryParseException(string message, System.Exception inner)
: base(message, inner) { }
}
public DictionaryParseException() { }
public DictionaryParseException(string message)
: base(message) { }
public DictionaryParseException(string message, System.Exception inner)
: base(message, inner) { }
}
48 changes: 22 additions & 26 deletions QuickFIXn/DataDictionary/IFieldMapSpec.cs
Original file line number Diff line number Diff line change
@@ -1,31 +1,27 @@
using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;

namespace QuickFix.DataDictionary
namespace QuickFix.DataDictionary;

public interface IFieldMapSpec
{
public interface IFieldMapSpec
{
/// <summary>
/// Returns true if this tag is for a group-counter field defined for this IFieldMapSpec
/// </summary>
/// <param name="tag"></param>
/// <returns></returns>
Boolean IsGroup(int tag);
/// <summary>
/// Returns true if this tag is for a group-counter field defined for this IFieldMapSpec
/// </summary>
/// <param name="tag"></param>
/// <returns></returns>
Boolean IsGroup(int tag);

/// <summary>
/// Returns true if this tag is for a field defined for this IFieldMapSpec
/// </summary>
/// <param name="tag"></param>
/// <returns></returns>
Boolean IsField(int tag);

/// <summary>
/// Returns true if this tag is for a field defined for this IFieldMapSpec
/// </summary>
/// <param name="tag"></param>
/// <returns></returns>
Boolean IsField(int tag);

/// <summary>
/// Get the IGroupSpec that corresponds to this group-counter tag
/// </summary>
/// <param name="tag"></param>
/// <returns></returns>
IGroupSpec GetGroupSpec(int tag);
}
/// <summary>
/// Get the IGroupSpec that corresponds to this group-counter tag
/// </summary>
/// <param name="tag"></param>
/// <returns></returns>
IGroupSpec GetGroupSpec(int tag);
}
15 changes: 7 additions & 8 deletions QuickFIXn/DataDictionary/IGroupSpec.cs
Original file line number Diff line number Diff line change
@@ -1,12 +1,11 @@
using System;

namespace QuickFix.DataDictionary
namespace QuickFix.DataDictionary;

public interface IGroupSpec : IFieldMapSpec
{
public interface IGroupSpec : IFieldMapSpec
{
/// <summary>
/// The tag of the delimiter field, i.e. the first field of each group member
/// </summary>
int Delim { get; set; }
}
/// <summary>
/// The tag of the delimiter field, i.e. the first field of each group member
/// </summary>
int Delim { get; set; }
}
23 changes: 11 additions & 12 deletions QuickFIXn/DataDictionary/InvalidMessageTypeException.cs
Original file line number Diff line number Diff line change
@@ -1,19 +1,18 @@
using System;

namespace QuickFix
namespace QuickFix.DataDictionary;

[Obsolete("This class will be removed in 1.16 (because it's unused)")]
public class InvalidMessageTypeException : ApplicationException
{
[Obsolete("This class will be removed in a future release (because it's unused)")]
public class InvalidMessageTypeException : ApplicationException
{
[Obsolete("This class will be removed in a future release (because it's unused)")]
public InvalidMessageTypeException() { }
public InvalidMessageTypeException() { }

[Obsolete("This class will be removed in a future release (because it's unused)")]
public InvalidMessageTypeException(string message)
: base(message) { }
[Obsolete("This class will be removed in a future release (because it's unused)")]
public InvalidMessageTypeException(string message)
: base(message) { }

[Obsolete("This class will be removed in a future release (because it's unused)")]
public InvalidMessageTypeException(string message, System.Exception inner)
: base(message, inner) { }
}
[Obsolete("This class will be removed in a future release (because it's unused)")]
public InvalidMessageTypeException(string message, System.Exception inner)
: base(message, inner) { }
}
32 changes: 14 additions & 18 deletions QuickFIXn/DataDictionary/MissingRequiredFieldException.cs
Original file line number Diff line number Diff line change
@@ -1,28 +1,24 @@
using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;

#pragma warning disable 0628 // Suppress "new protected member declared in sealed class" warning.

namespace QuickFix
namespace QuickFix.DataDictionary;

[Obsolete("This class will be removed in 1.16 (because it's unused)")]
public sealed class MissingRequiredFieldException : ApplicationException
{
[Obsolete("This class will be removed in a future release (because it's unused)")]
public sealed class MissingRequiredFieldException : ApplicationException
{
[Obsolete("This class will be removed in a future release (because it's unused)")]
public MissingRequiredFieldException() { }
public MissingRequiredFieldException() { }

[Obsolete("This class will be removed in a future release (because it's unused)")]
public MissingRequiredFieldException(int field)
: base("Missing required field: " + field.ToString()) { }
[Obsolete("This class will be removed in a future release (because it's unused)")]
public MissingRequiredFieldException(int field)
: base($"Missing required field: {field}") { }

[Obsolete("This class will be removed in a future release (because it's unused)")]
public MissingRequiredFieldException(string message)
: base(message) { }
[Obsolete("This class will be removed in a future release (because it's unused)")]
public MissingRequiredFieldException(string message)
: base(message) { }

[Obsolete("This class will be removed in a future release (because it's unused)")]
public MissingRequiredFieldException(string message, System.Exception inner)
: base(message, inner) { }
}
[Obsolete("This class will be removed in a future release (because it's unused)")]
public MissingRequiredFieldException(string message, System.Exception inner)
: base(message, inner) { }
}
Loading
Loading