Click or drag to resize

CommonHeaderBaseTTypeIdentifier Class

Represents the base class for a common binary image header implementation.
Inheritance Hierarchy

Namespace: GSF.Parsing
Assembly: GSF.Core (in GSF.Core.dll) Version: 2.4.207-beta+1781b796b2aa7a54013a031eb432fe4ccee31867
Syntax
public abstract class CommonHeaderBase<TTypeIdentifier> : ICommonHeader<TTypeIdentifier>
View Source

Type Parameters

TTypeIdentifier
Type of identifier used to distinguish output types.

The CommonHeaderBaseTTypeIdentifier type exposes the following members.

Constructors
 NameDescription
Protected methodCommonHeaderBaseTTypeIdentifierInitializes a new instance of the CommonHeaderBaseTTypeIdentifier class
Top
Properties
 NameDescription
Public propertyState Gets or sets any additional state information that might be needed for parsing.
Public propertyTypeID Gets or sets the identifier used for identifying the Type to be parsed.
Top
Methods
 NameDescription
Public methodEqualsDetermines whether the specified object is equal to the current object.
(Inherited from Object)
Protected methodFinalizeAllows an object to try to free resources and perform other cleanup operations before it is reclaimed by garbage collection.
(Inherited from Object)
Public methodGetHashCodeServes as the default hash function.
(Inherited from Object)
Public methodGetTypeGets the Type of the current instance.
(Inherited from Object)
Protected methodMemberwiseCloneCreates a shallow copy of the current Object.
(Inherited from Object)
Public methodToStringReturns a string that represents the current object.
(Inherited from Object)
Top
Extension Methods
 NameDescription
Public Extension MethodGetEnumValueOrDefault Gets the enumeration constant for value, if defined in the enumeration, or a default value.
(Defined by EnumExtensions)
Public Extension MethodGetEnumValueOrDefaultT Gets the enumeration constant for this value, if defined in the enumeration, or a default value.
(Defined by EnumExtensions)
Top
Remarks
Here is an example of a possible derived class constructor that has an integer TypeID as the first 4 bytes in the image:
C#
public CommonHeader(object state, byte[] binaryImage, int startIndex, int length)
{
    if (length > 3)
    {
        TypeID = LittleEndian.ToInt32(binaryImage, startIndex);
        State = state;
    }
    else
        throw new InvalidOperationException("Malformed image");
}
See Also