/// <summary> /// Formats a message with a given starting indent. /// </summary> /// <param name="msg">message to format</param> /// <param name="depth">starting indent</param> protected void Format(IFudgeFieldContainer msg, int depth) { if (msg == null) { return; } IList <IFudgeField> fields = msg.GetAllFields(); IList <string> fieldSpecs = new List <string>(fields.Count); int maxFieldSpecWidth = -1; int maxTypeNameWidth = -1; for (int i = 0; i < fields.Count; i++) { IFudgeField field = fields[i]; string fieldSpec = GetFieldSpec(field, i, depth); maxFieldSpecWidth = Math.Max(maxFieldSpecWidth, fieldSpec.Length); maxTypeNameWidth = Math.Max(maxTypeNameWidth, GetTypeName(field.Type).Length); fieldSpecs.Add(fieldSpec); } for (int i = 0; i < fields.Count; i++) { IFudgeField field = fields[i]; string fieldSpec = fieldSpecs[i]; Format(field, i, depth, fieldSpec, maxFieldSpecWidth, maxTypeNameWidth); } }
private static int WriteMsgFields(BinaryWriter bw, IFudgeFieldContainer container, IFudgeTaxonomy taxonomy) //throws IOException { int nWritten = 0; foreach (IFudgeField field in container.GetAllFields()) { nWritten += WriteField(bw, field.Type, field.Value, field.Ordinal, field.Name, taxonomy); } return(nWritten); }
//throws IOException private static int WriteMsgFields(BinaryWriter bw, IFudgeFieldContainer container, IFudgeTaxonomy taxonomy) { int nWritten = 0; foreach (IFudgeField field in container.GetAllFields()) { nWritten += WriteField(bw, field.Type, field.Value, field.Ordinal, field.Name, taxonomy); } return nWritten; }
public State(IFudgeFieldContainer msg) { Msg = msg; Fields = new Queue<IFudgeField>(msg.GetAllFields()); }
/// <summary> /// Formats a message with a given starting indent. /// </summary> /// <param name="msg">message to format</param> /// <param name="depth">starting indent</param> protected void Format(IFudgeFieldContainer msg, int depth) { if (msg == null) { return; } IList<IFudgeField> fields = msg.GetAllFields(); IList<string> fieldSpecs = new List<string>(fields.Count); int maxFieldSpecWidth = -1; int maxTypeNameWidth = -1; for (int i = 0; i < fields.Count; i++) { IFudgeField field = fields[i]; string fieldSpec = GetFieldSpec(field, i, depth); maxFieldSpecWidth = Math.Max(maxFieldSpecWidth, fieldSpec.Length); maxTypeNameWidth = Math.Max(maxTypeNameWidth, GetTypeName(field.Type).Length); fieldSpecs.Add(fieldSpec); } for (int i = 0; i < fields.Count; i++) { IFudgeField field = fields[i]; string fieldSpec = fieldSpecs[i]; Format(field, i, depth, fieldSpec, maxFieldSpecWidth, maxTypeNameWidth); } }