C# Class Lawo.EmberPlusSharp.Ember.EmberType

Describes an EmBER type.

An EmberType instance contains most of the information that is necessary to read and write a data value of a given type with EmberReader and EmberWriter. Moreover, it also contains the information to convert a data value to and from XML.

An EmberType object is typically created by providing a System.Type object representing a class that contains two constants describing the type itself and that optionally contains one nested class describing each field. Each of the nested classes in turn contains 3 constants. So, a primitive type (which does not contain any fields) can be represented like e.g. BerBoolean, BerReal, etc. A type with fields, like e.g. the Glow Command, can be described as follows:

internal static class GlowCommand { internal const int InnerNumber = Ember.InnerNumber.FirstApplication + 2; internal const string Name = "Command"; internal static class Number { internal const int OuterNumber = 0; internal const string Name = "number"; internal static readonly EmberId OuterId = EmberId.CreateContextSpecific(OuterNumber); } internal static class DirFieldMask { internal const int OuterNumber = 1; internal const string Name = "dirFieldMask"; internal static readonly EmberId OuterId = EmberId.CreateContextSpecific(OuterNumber); } }

This form of description was chosen so that e.g. code that turns a serialized Glow Command into an in-memory representation can directly use these constants. On the other hand, code that needs to transform a serialized EmBER representation to and from e.g. XML, can easily use reflection to build high performance lookup tables from the information contained in these classes.

The fields of a type can usually unambiguously be identified by an EmberType instance constructed by passing a single System.Type instance. However, certain DTDs store fields in plain BER sequence or set types. For these fields, it is necessary to also consider one or more parent fields. This is why the constructor also accepts two or more types, where the first types represent the path to the last type.

Show file Open project: Lawo/ember-plus-sharp

Private Properties

Property Type Description

Public Methods

Method Description
EmberType ( ) : System

Initializes a new instance of the EmberType class.

FromType ( Type type ) : EmberType

Creates a EmberType from type.

Method Details

EmberType() public method

Initializes a new instance of the EmberType class.
equals null.
public EmberType ( ) : System
return System

FromType() public static method

Creates a EmberType from type.
equals null.
public static FromType ( Type type ) : EmberType
type System.Type
return EmberType