Post

MetaDictionary

Maps a Thermo trailer label to the MetaClass it represents.


Remarks

Maps a Thermo trailer label to the MetaClass it represents.

Trailer labels vary between instruments and file versions, so several spellings map to the same value. “Charge State”, “Charge State:”, “Charge” and “Z” all resolve to MetaClass.ChargeState.

This is a static class. There is nothing to construct.


Methods

MethodReturnsDescription
static FindMeta(string label)MetaClassLooks up a trailer label. Returns the matching MetaClass, or MetaClass.None if the label is not recognized.

Example

1
2
3
4
5
6
7
8
9
using Nova.Io.Meta;

// Several spellings map to the same MetaClass, because the label
// varies between instruments and file versions.
MetaClass a = MetaDictionary.FindMeta("Charge State");
MetaClass b = MetaDictionary.FindMeta("Z");

// An unrecognized label returns None rather than throwing.
MetaClass unknown = MetaDictionary.FindMeta("Not A Real Label");
1
2
3
4
5
6
7
8
9
10
11
12
13
14
switch (MetaDictionary.FindMeta(label))
{
  case MetaClass.ChargeState:
    Console.WriteLine("charge " + value);
    break;

  case MetaClass.FaimsCV:
    Console.WriteLine("FAIMS CV " + value);
    break;

  case MetaClass.None:
    // Nothing recognized this label, so leave it alone.
    break;
}
This post is licensed under CC BY 4.0 by the author.

Trending Tags